Host implementation of virtual devices

ABSTRACT

A host computer to establishes a coupling between a logical storage area of a storage device and a virtual storage area of the storage device by sending a first command to the storage device to register the logical storage area. Following the first command, the host computer sends a second command to the storage device to relate the logical storage area to the virtual storage area. Following the second command, the host computer sends a third command to the storage device to activate the coupling between the logical storage area and the virtual storage area, where following activating the coupling, pointers of the virtual storage area point to sections of the logical storage area and where a write to the logical storage area causes data to be copied from the logical storage area to an other area of the storage device.

CROSS REFERENCE TO RELATED APPLICATIONS

[0001] This application is a continuation-in-part of U.S. patentapplication Ser. No. 10/120,016 filed on Apr. 10, 2002 (pending).

BACKGROUND OF THE INVENTION

[0002] 1. Technical Field

[0003] This application relates to computer storage devices, and moreparticularly to the field of providing copies of portions of data storedon a computer storage device.

[0004] 2. Description of Related Art

[0005] Host processor systems may store and retrieve data using astorage device containing a plurality of host interface units (hostadapters), disk drives, and disk interface units (disk adapters). Suchstorage devices are provided, for example, by EMC Corporation ofHopkinton, Mass. and disclosed in U.S. Pat. Nos. 5,206,939 to Yanai etal., 5,778,394 to Galtzur et al., U.S. Pat. No. 5,845,147 to Vishlitzkyet al., and U.S. Pat. No. 5,857,208 to Ofek. The host systems access thestorage device through a plurality of channels provided therewith. Hostsystems provide data and access control information through the channelsof the storage device and the storage device provides data to the hostsystems also through the channels. The host systems do not address thedisk drives of the storage device directly, but rather, access whatappears to the host systems as a plurality of logical volumes. Thelogical volumes may or may nor correspond to the actual disk drives.

[0006] In some instances, it may desirable to provide a copy of alogical volume where the copy is then accessed by other processes. Forexample, to test new software on actual stored data, a copy of a logicalvolume containing the data may be made and the copy, as opposed to theoriginal data, may be used to test new software. Once the test iscomplete, the copy may be eliminated. Thus, the new software is testedon actual data without affecting the actual data. This reduces thelikelihood that testing new software and/or functionality will corruptactual data.

[0007] One difficulty with making such copies is that they require asmuch storage space as the logical volume from which the data is obtainedsince the copy process simply creates a new volume containing all thedata of the original volume. In addition, in some instances, thedifferences between the original volume and the copy are minimal. Thus,the extra storage space required for such a copy of a logical volume isused somewhat inefficiently since it merely duplicates already-existingdata. Accordingly, it would be desirable to provide a mechanism forcopying data in a way that uses storage space efficiently.

SUMMARY OF THE INVENTION

[0008] According to the present invention, accessing stored dataincludes providing a virtual storage area having a table of pointersthat point to sections of at least two other storage areas, where thevirtual storage area contains no sections of data, in response to arequest for accessing data of the virtual storage area, determiningwhich particular one of the other storage areas contain the data, andaccessing the data on the particular one of the other storage areasusing the table of pointers. Accessing stored data may also includeassociating a first one of the other storage areas with the virtualstorage area, where the virtual storage area represents a copy of dataof the first one of the other storage areas. Accessing stored data mayalso include causing all of the pointers of the table to initially pointto sections of the first one of the other storage areas when the virtualstorage area is initially associated with the first one of the otherstorage areas. Accessing stored data may also include, in response to awrite to a first section on the first one of the other storage areas,copying data of the first section to a second section that is on asecond one of the other storage areas and causing a corresponding one ofthe pointers of the table to point to the second section. Prior tocopying data from the first section to the second section, the secondsection may be maintained as a free section containing no data.Accessing stored data may also include maintaining a doubly linked listof all free sections of the second one of the other storage areas.Accessing stored data may also include associating a data indicator withsections of the first one of the other storage areas, where the dataindicator for a particular section indicates whether a write operationhas been performed to the particular section after the first one of theother storage areas has been associated with the virtual storage area.Accessing stored data may also include, in response to a write to afirst section on the first one of the other storage areas and the dataindicator indicating that no write operation has been performed to thefirst section after the first one of the other storage areas has beenassociated with the virtual storage area, copying data of the firstsection to a second section that is on a second one of the other storageareas and causing a corresponding one of the pointers of the table topoint to the second section. Accessing stored data may also includesending status information to a device that caused the write operationto be performed following copying the data from the first section to thesecond section. Each of the sections of data may be a track of data.Each of the storage areas may be a storage device.

[0009] According further to the present invention, accessing stored dataincludes providing a first virtual storage area having a first table ofpointers that point to sections of at least two other storage areas,where the first virtual storage area contains no sections of data,associating a first one of the other storage areas with the firstvirtual storage area, where the first virtual storage area represents acopy of data of the first one of the other storage areas at a firstpoint in time, providing a second virtual storage area having a secondtable of pointers that point to sections of at least two other storageareas, where the second virtual storage area contains no sections ofdata, associating the first one of the other storage areas with thesecond virtual storage area, where the first virtual storage arearepresents a copy of data of the first one of the other storage areas ata second point in time, in response to a request for accessing data ofone of the virtual storage areas, determining which particular one ofthe other storage areas contain the data, and accessing the data on theparticular one of the other storage areas using one of the tables ofpointers. Accessing stored data may also include causing all of thepointers of the first table to initially point to sections of the firstone of the other storage areas when the first virtual storage area isinitially associated with the first one of the other storage areas andcausing all of the pointers of the second table to initially point tosections of the first one of the other storage areas when the secondvirtual storage area is initially associated with the first one of theother storage areas. Accessing stored data may further includeassociating a first data indicator with sections of the first one of theother storage areas, where the first data indicator for a particularsection of the first other one of the storage areas indicates whether awrite operation has been performed to the particular section after thefirst one of the other storage areas has been associated with the firstvirtual storage area, and associating a second data indicator withsections of the first one of the other storage areas, where the seconddata indicator for a particular section of the first other one of thestorage areas indicates whether a write operation has been performed tothe particular section after the second one of the other storage areashas been associated with the second virtual storage area. Accessingstored data may also include, in response to a write to a first sectionthat is on the first one of the other storage areas and the dataindicator indicating that no write operation has been performed to thefirst section after the first one of the other storage areas has beenassociated with the first virtual storage area, copying data of thefirst section to a second section that is on a second one of the otherstorage areas and causing a corresponding one of the pointers of thefirst table to point to the second section. Accessing stored data mayalso include, in response to a write to a first section that is on thefirst one of the other storage areas and the data indicator indicatingthat no write operation has been performed to the first section afterthe first one of the other storage areas has been associated with thefirst and second virtual storage areas, copying data of the firstsection to a second section that is on a second one of the other storageareas and causing a corresponding one of the pointers of the first tableand a corresponding one of the pointers of the second table to point tothe second section. Accessing stored data may also include, in responseto a write to the first virtual storage area corresponding to the secondsection, copying data from the second section to a third section.Accessing stored data may also include causing a corresponding one ofthe pointers of the first table to point to the third section. Accessingstored data may also include causing a corresponding one of the pointersof the second table to point to the third section. The first time may bethe same as the second time. The first time may be different from thesecond time. Each of the sections of data may be a track of data. Eachof the storage areas may be a storage device.

[0010] According further to the present invention, a computer programproduct includes executable code that provides a virtual storage areahaving a table of pointers that point to sections of at least two otherstorage areas, where the virtual storage area contains no sections ofdata, executable code that determines which particular one of the otherstorage areas contain the data in response to a request for accessingdata of the virtual storage area, and executable code that accesses thedata on the particular one of the other storage areas using the table ofpointers. The computer program product may also include executable codethat associates a first one of the other storage areas with the virtualstorage area, where the virtual storage area represents a copy of dataof the first one of the other storage areas. The computer programproduct may also include executable code that causes all of the pointersof the table to initially point to sections of the first one of theother storage areas when the virtual storage area is initiallyassociated with the first one of the other storage areas. The computerprogram product may also include executable code that copies data of thefirst section to a second section that is on a second one of the otherstorage areas and causes a corresponding one of the pointers of thetable to point to the second section in response to a write to a firstsection on the first one of the other storage areas. The computerprogram product may also include executable code that associates a dataindicator with sections of the first one of the other storage areas,where the data indicator for a particular section indicates whether awrite operation has been performed to the particular section after thefirst one of the other storage areas has been associated with thevirtual storage area. The computer program product may also includeexecutable code that copies data of the first section to a secondsection that is on a second one of the other storage areas and causes acorresponding one of the pointers of the table to point to the secondsection in response to a write to a first section on the first one ofthe other storage areas and the data indicator indicating that no writeoperation has been performed to the first section after the first one ofthe other storage areas has been associated with the virtual storagearea. The computer program product may also include executable code thatsends status information to a device that caused the write operation tobe performed following copying the data from the first section to thesecond section. Each of the sections of data may be a track of data.Each of the storage areas may be a storage device.

[0011] According further to the present invention, a virtual storagedevice includes at least one table for associating the virtual storagedevice with a standard storage device, storage for sections of data ofthe virtual storage device, where a first portion of the storage forsections is sections of data of the standard storage device, and a firstplurality of pointers provided with the at least one table, where atleast some of the pointers point to sections of the standard storagedevice corresponding to the first portion. The virtual storage devicemay also include a second portion of the storage for sections thatcontain data that is different from data on corresponding sections ofthe standard storage device that map to the second portion, and a secondplurality of pointers provided with the at least one table, where thesecond plurality of pointers point to sections of a device differentfrom the standard storage device. Each section of the second portion maycontain an earlier version of data on a corresponding section of thestandard storage device. Each of the sections of data may be a track ofdata.

[0012] According to the present invention, a host computer toestablishes a coupling between a logical storage area of a storagedevice and a virtual storage area of the storage device, by sending afirst command to the storage device to register the logical storagearea, following the first command, the host computer sending a secondcommand to the storage device to relate the logical storage area to thevirtual storage area, and following the second command, the hostcomputer sending a third command to the storage device to activate thecoupling between the logical storage area and the virtual storage area,where following activating the coupling, pointers of the virtual storagearea point to sections of the logical storage area and where a write tothe logical storage area causes data to be copied from the logicalstorage area to an other area of the storage device and causes acorresponding pointer of the virtual storage area to point to the otherarea. The first command may cause creation of the virtual storage area.The second command may cause creation of the virtual storage area. Thesecond command may include additional parameters, which may be selectedfrom the group consisting of: a new name for the virtual storage areaand an indicator that determines whether the virtual storage area isavailable to a host. The storage areas may be devices.

[0013] According further to the present invention, a host computerestablishes a coupling between at least one of a plurality of logicalstorage areas of a storage device and at least one of a correspondingone of a plurality of virtual storage areas of the storage device bysending commands to the storage device to relate the at least one of thelogical storage areas to a corresponding one of the virtual storageareas and by, following sending commands, causing an activation ofcouplings between at least one of the plurality of the logical storageareas and corresponding ones of the plurality of virtual storage areas,where following activation, pointers of at least one of the virtualstorage areas corresponding to the couplings point to sections of acorresponding one of the logical storage areas and where a write to thecorresponding one of the logical storage areas causes data to be copiedfrom the corresponding one of logical storage areas to an other area ofthe storage device and causes a corresponding pointer of the at leastone of the virtual storage areas to point to the other area. The hostsending commands may cause creation of the at least one of the virtualstorage areas. Causing activation may include the host sendingadditional commands. The additional commands may include parameters,which may be selected from the group consisting of: a new name for atleast one of the virtual storage areas and an indicator that determineswhether at least one of the virtual storage areas is available to ahost. A host computer establishing a coupling between at least one of aplurality of logical storage areas of a storage device and at least oneof a corresponding one of a plurality of virtual storage areas of thestorage device may also include the host maintaining a list of thelogical storage areas and the virtual storage areas. Activation ofcouplings may include passing the list from the host to the storagedevice. The list may be a linked list. Passing the list may includepassing a pointer to a data structure that contains one of: the list anda pointer to the list. The logical storage areas may all be part of asingle consistency group. Causing an activation of couplings may includethe host providing one activate command to the storage device for eachlogical storage area/virtual storage area pair. Causing an activation ofcouplings may include the host providing a single activate command tothe storage device that activates all of the logical storagearea/virtual storage area pairs. The storage areas may be devices.

[0014] According further to the present invention, computer softwarethat establishes a coupling between a logical storage area of a storagedevice and a virtual storage area of the storage device includesexecutable code that sends a first command to the storage device toregister the logical storage area, executable code that sends a secondcommand to the storage device to relate the logical storage area to thevirtual storage area following sending the first command, and executablecode that sends a third command to the storage device to activate thecoupling between the logical storage area and the virtual storage areafollowing the second command, where following activating the coupling,pointers of the virtual storage area point to sections of the logicalstorage area and where a write to the logical storage area causes datato be copied from the logical storage area to an other area of thestorage device and causes a corresponding pointer of the virtual storagearea to point to the other area. The second command may includeadditional parameters, which may be selected from the group consistingof: a new name for the virtual storage area and an indicator thatdetermines whether the virtual storage area is available to a host.

[0015] According further to the present invention, computer softwarethat establishes a coupling between at least one of a plurality oflogical storage areas of a storage device and at least one of acorresponding one of a plurality of virtual storage areas of the storagedevice, includes executable code that sends commands to the storagedevice to relate the at least one of the logical storage areas to acorresponding one of the virtual storage areas and executable code thatcauses an activation of couplings between at least one of the pluralityof the logical storage areas and corresponding ones of the plurality ofvirtual storage areas after the commands are sent, where followingactivation, pointers of at least one of the virtual storage areascorresponding to the couplings point to sections of a corresponding oneof the logical storage areas and where a write to the corresponding oneof the logical storage areas causes data to be copied from thecorresponding one of logical storage areas to an other area of thestorage device and causes a corresponding pointer of the at least one ofthe virtual storage areas to point to the other area. Executable codethat causes activation may send additional commands. The additionalcommands may include parameters that may be selected from the groupconsisting of: a new name for at least one of the virtual storage areasand an indicator that determines whether at least one of the virtualstorage areas is available to a host. The computer software may alsoinclude executable code that maintains a list of the logical storageareas and the virtual storage areas.

[0016] According further to the present invention, handling dataincludes providing a first storage area of a first type that containssections of data, providing a second storage area of the first type thatcontains sections of data, providing a third storage area of a secondtype where the second type has, for each section thereof, a pointer toone of: a corresponding section of data of the first storage area and acorresponding section of data of the second storage area, causing thethird storage area to be not available for accessing, and after causingthe third storage area to not be available for accessing, providing datafrom the second storage area corresponding to pointers of the thirdstorage area that point to sections of the second storage area. Handlingdata-may also include, after providing the storage areas and prior tocausing the third storage area to not be available, handling a write toa particular section of the first storage area pointed to by acorresponding pointer of the third storage area by copying data from theparticular section of the first storage area to a corresponding sectionof the second storage area and adjusting the corresponding pointer ofthe third storage area to point to the corresponding section of thesecond storage area. Handling data may also include, after causing thethird storage area to not be available, handling a write to a particularsection of the first storage area by writing the data thereto. Causingthe third storage area to not be available may include providing a valuein a header for the first storage area, where the value indicates thatno operation is to be performed in connection with a set protection bitencountered when data is written to a corresponding section of the firststorage area. Handling data may also include inhibiting access to thefirst storage area prior to providing the value to the header andallowing access to the first storage area after providing the value tothe header. The storage areas may be devices.

[0017] According further to the present invention, retrieving requesteddata from a virtual storage area includes determining if the virtualstorage area is deactivated, if the virtual storage area is deactivated,determining if the requested data corresponds to data handled by thevirtual storage area prior to being deactivated, and if the requesteddata corresponds to data handled by the virtual storage area prior tobeing deactivated, providing the requested data. Determining if therequested data corresponds to data handled by the virtual storage areaprior to being deactivated may include examining protection bits of acorresponding standard logical storage area. Providing the requesteddata may include reading the virtual storage area. The storage areas maybe devices.

[0018] According further to the present invention, restoring data to aprevious version, includes obtaining a current version of the data,obtaining previously archived sections of the data, and iterativelyapplying the previously archived sections of data to the current versionand to resulting intermediate versions until the data corresponds to theprevious version of the data. Previously archived sections maycorrespond to versions of the sections that existed prior to archiving.Archiving may include providing a virtual storage area containingpointers to sections of data of a logical storage area and, in responseto a write to a section of the logical storage area, copying data fromthe logical storage area to an other area and causing the virtualstorage area to point to the other area, where the other area containsthe archived data.

[0019] According further to the present invention, computer softwarehandles data used in connection with a first storage area of a firsttype that contains sections of data, a second storage area of the firsttype that contains sections of data and a third storage area of a secondtype wherein the second type has, for each section thereof, a pointer toone of: a corresponding section of data of the first storage area and acorresponding section of data of the second storage area and thesoftware includes executable code that causes the third storage area tobe not available for accessing and executable code that, after the thirdstorage area is not available for accessing, provides data from thesecond storage area corresponding to pointers of the third storage areathat point to sections of the second storage area. Executable code thatcauses the third storage area to not be available may include executablecode that provides a value in a header for the first storage area, wherethe value indicates that no operation is to be performed in connectionwith a set protection bit encountered when data is written to acorresponding section of the first storage area.

[0020] According further to the present invention, computer softwarethat retrieves requested data from a virtual storage area includesexecutable code that determines if the virtual storage area isdeactivated, executable code that, if the virtual storage area isdeactivated, determines if the requested data corresponds to datahandled by the virtual storage area prior to being deactivated, andexecutable code that, if the requested data corresponds to data handledby the virtual storage area prior to being deactivated, provides therequested data. The software may also include executable code thatexamines protection bits of a corresponding standard logical storagearea. The software may also include executable code that reads thevirtual storage area.

[0021] According further to the present invention, computer softwarethat restores data to a previous version includes executable code thatobtains a current version of the data, executable code that obtainspreviously archived sections of the data, and executable code thatiteratively applies the previously archived sections of data to thecurrent version and to resulting intermediate versions until the datacorresponds to the previous version of the data. Previously archivedsections may correspond to versions of the sections that existed priorto archiving.

[0022] According further to the present invention, accessing dataincludes a host establishing a relationship between a first storage areaof a first type containing data and a second storage area of a secondtype containing pointers to data provided in storage areas of the firsttype, where the storage areas are provided in a storage device coupledto the host, in response to the host writing data to a particularsection of the first storage area after establishing the relationship,the particular section being copied from the first storage area to athird storage area of the first type prior to the write operation beingexecuted, and a corresponding pointer of the second storage area beingadjusted to point to the third storage area. Accessing data may alsoinclude restoring data from the second storage area to the first storagearea. Accessing data may also include restoring data from the secondstorage area to a fourth storage area of the first type. The fourthstorage area may be a split mirror of the first storage area. The firstand second storage areas may be storage devices. Establishing arelationship may include the host providing an optional new name for thesecond storage device. Establishing a relationship may include the hostproviding an optional online/offline parameter for the second storagedevice. Accessing data may also include deactivating the second storagearea by making the second storage area not available to the host.Accessing data may also include making sections copied from the firststorage area to the third storage area available to the host. Thestorage areas may be devices.

[0023] According further to the present invention, providing a virtualstorage area containing no sections of data, includes providing firstand second storage areas, each containing sections of data, andproviding a plurality of pointers, where each pointer points to one of:a section of the first storage area and a section of the second storagearea. The virtual storage area may represent a point in time copy of thefirst storage area. Prior to writing data to a particular section of thefirst storage area pointed to by a particular pointer of the virtualstorage area, the particular section may be copied to the second storagearea and the particular pointer may be made to point thereto. Thepointers, virtual storage area, first storage area, and second storagearea may all be provided on a storage device. Data corresponding to thevirtual storage area may be accessed by a plurality of host processorscoupled to the storage device. The storage areas may be storage devices.

[0024] According further to the present invention, accessing data storedin connection with a virtual storage area containing no sections of dataincludes obtaining a pointer of the virtual storage area correspondingto the data, in response to the pointer pointing to a first storagearea, accessing the first storage area, and in response to the pointerpointing to a second storage area, accessing the second storage area.The pointers, virtual storage area, first storage area, and secondstorage area may all be provided on a storage device. Data correspondingto the virtual storage area may be accessed by a plurality of hostprocessors coupled to the storage device. The storage areas may bedevices.

[0025] According further to the present invention, computer softwarethat provides a virtual storage area containing no sections of data,includes executable code that provides first and second storage areas,each containing sections of data and executable code that provides aplurality of pointers, wherein each pointer points to one of: a sectionof the first storage area and a section of the second storage area. Thevirtual storage area may represent a point in time copy of the firststorage area. The computer software may also include executable codethat, prior to writing data to a particular section of the first storagearea pointed to by a particular pointer of the virtual storage area,executable code that copies the particular section to the second storagearea and adjusts the particular pointer to point thereto.

[0026] According further to the present invention, computer softwarethat accesses data stored in connection with a virtual storage areacontaining no sections of data, includes executable code that obtains apointer of the virtual storage area corresponding to the data,executable code that, in response to the pointer pointing to a firststorage area, accesses the first storage area, and executable code that,in response to the pointer pointing to a second storage area, accessesthe second storage area.

[0027] According further to the present invention, establishing aplurality of storage areas includes associating each of a firstplurality of storage areas of a first type that contain sections of datawith corresponding ones of second plurality of storage areas of a secondtype having pointers to alternative sections of data storage areas ofthe first type, wherein initially none of the second plurality ofstorage areas is available for accessing data corresponding thereto,and, after associating all of the first and second plurality of storageareas, activating the second plurality of storage areas to make thesecond plurality of storage areas available for accessing data.Establishing a plurality of storage areas may also include, prior toactivating the second plurality of storage areas, setting pointers ofthe second plurality of storage areas to point to sections ofcorresponding ones of the first plurality of storage areas. Establishinga plurality of storage areas may also include, after activating thesecond plurality of storage areas, responding to a write to one of thefirst plurality of storage areas by copying a portion of data thereof tothe alternative sections of data storage areas and adjusting a pointerof a corresponding one of the second plurality of storage areas to pointto the alternative sections of data storage areas. Establishing aplurality of storage areas may also include enabling exclusive access tothe first plurality of storage areas prior to activating the secondplurality of storage areas, and disabling exclusive access to the firstplurality of storage areas after activating the second plurality ofstorage areas. Establishing a plurality of storage areas may alsoinclude enabling exclusive access to one of the first plurality ofstorage areas prior to activating a corresponding one of the secondplurality of storage areas, and disabling exclusive access to the one ofthe first plurality of storage areas after activating the correspondingone of the second plurality of storage areas. Activating the secondplurality of storage areas may include providing a value in deviceheaders for each of the second plurality of storage areas. Establishinga plurality of storage areas may also include establishing a consistencygroup for the logical storage areas and the virtual storage areas.Associating each of the first plurality of storage areas withcorresponding ones of the second plurality of storage areas may includemaking a list of associated storage areas that is used in connectionwith activating the storage areas. The list may be a linked list.Activating the second plurality of storage areas may includes setting aparticular protection bit for each section of each of the firstplurality of storage areas, and setting a value in each of the headersfor each of the first plurality of storage areas, wherein the valueindicates that special processing is to be performed in response to awrite to a section of the first plurality of storage areas having aprotection bit set. The storage areas may be devices.

[0028] According to the present invention, computer software thatestablishes a plurality of storage areas includes executable code thatassociates each of a first plurality of storage areas of a first typethat contain sections of data with corresponding ones of secondplurality of storage areas of a second type having pointers toalternative sections of data storage areas of the first type, whereinitially none of the second plurality of storage areas is available foraccessing data corresponding thereto and executable code that, afterassociating all of the first and second plurality of storage areas,activates the second plurality of storage areas to make the secondplurality of storage areas available for accessing data. The computersoftware may also include executable code that, prior to activating thesecond plurality of storage areas, sets pointers of the second pluralityof storage areas to point to sections of corresponding ones of the firstplurality of storage areas. The computer software may also includeexecutable code that, after activating the second plurality of storageareas, responds to a write to one of the first plurality of storageareas by copying a portion of data thereof to the alternative sectionsof data storage areas and adjusting a pointer of a corresponding one ofthe second plurality of storage areas to point to the alternativesections of data storage areas. The computer software may also includeexecutable code that enables exclusive access to the first plurality ofstorage areas prior to activating the second plurality of storage areasand executable code that disables exclusive access to the firstplurality of storage areas after activating the second plurality ofstorage areas. The computer software may also include executable codethat enables exclusive access to one of the first plurality of storageareas prior to activating a corresponding one of the second plurality ofstorage areas and executable code that disables exclusive access to theone of the first plurality of storage areas after activating thecorresponding one of the second plurality of storage areas. Executablecode that activates the second plurality of storage areas may includeexecutable code that provides a value in device headers for each of thesecond plurality of storage areas. The computer software may alsoinclude executable code that establishes a consistency group for thelogical storage areas and the virtual storage areas. Executable codethat associates each of the first plurality of storage areas withcorresponding ones of the second plurality of storage areas may alsomake a list of associated storage areas that is used in connection withactivating the storage areas. The list may be a linked list. Executablecode that activates the second plurality of storage areas may also set aparticular protection bit for each section of each of the firstplurality of storage areas and may also set a value in each of theheaders for each of the first plurality of storage areas, where thevalue indicates that special processing is to be performed in responseto a write to a section of the first plurality of storage areas having aprotection bit set.

[0029] According further to the present invention, restoring dataincludes providing data in a first storage area of a first type thatcontains sections of data, providing data in a second storage area of asecond type wherein the second type has, for each section of datathereof, at least one of: a pointer to a corresponding section of dataof the first storage area and a pointer to corresponding section of dataof a third storage area of the first type, and, for each particularsection of data of the second storage area having a pointer to the thirdstorage area, replacing a corresponding section of the first storagearea with a pointer to the third storage area. Restoring data may alsoinclude, after replacing all of the particular sections of the firststorage area, deallocating the second storage area. Restoring data mayalso include, after replacing all of the particular sections of thefirst storage area, causing data to be copied from the third storagearea to the first storage area. The storage areas may be devices.

[0030] According further to the present invention, restoring dataincludes providing data in a first storage area of a first type thatcontains sections of data, providing data in a second storage area of asecond type wherein the second type has, for each section of datathereof, at least one of: a pointer to a corresponding section of dataof the first storage area and a pointer to corresponding section of dataof a third storage area of the first type, for each particular sectionof data of the second storage area having a pointer to the third storagearea, replacing a corresponding section of a fourth storage area of thefirst type with the pointer to the third storage area, and, for eachparticular section of data of the second storage area having a pointerto the first storage area, replacing a corresponding section of thefourth storage area with a pointer to the first storage area. Restoringdata may also include, after replacing all of the particular sections ofthe fourth storage area, deallocating the second storage area. Restoringdata may also include, after replacing all of the particular sections ofthe fourth storage area, causing data to be copied from the first andthird storage areas to the fourth storage area. The storage areas may bedevices.

[0031] According further to the present invention, restoring dataincludes providing data in a first storage area of a first type thatcontains sections of data, providing data in a second storage area of asecond type where the second type has, for each section of data thereof,at least one of: a pointer to a corresponding section of data of thefirst storage area and a pointer to corresponding section of data of athird storage area of the first type, and, for each particular sectionof data of the second storage area having a pointer to the third storagearea, replacing a corresponding section of a fourth storage area of thefirst type with a pointer to the third storage area, where the fourthstorage area is at least a partial mirror copy of the first storagearea. Restoring data may also include, after replacing all of theparticular sections of the fourth storage area, deallocating the secondstorage area. Restoring data may also include, after replacing all ofthe particular sections of the fourth storage area, causing data to becopied from the third storage area to the fourth storage area. Thestorage areas may be devices.

[0032] According further to the present invention, restoring dataincludes providing data in a first storage area of a first type thatcontains sections of data, providing data in a second storage area of asecond type wherein the second type has, for each section of datathereof, at least one of: a pointer to a corresponding section of dataof the first storage area and a pointer to corresponding section of dataof a third storage area of the first type, and copying data from thesecond storage area to a third storage area of the second type.Restoring data may also include, after copying data, deallocating thesecond storage area.

[0033] According further to the present invention, computer softwarerestores data, in connection with a system that provides data in a firststorage area of a first type that contains sections of data and providesdata in a second storage area of a second type wherein the second typehas, for each section of data thereof, at least one of: a pointer to acorresponding section of data of the first storage area and a pointer tocorresponding section of data of a third storage area of the first type,and the software includes executable code that, for each particularsection of data of the second storage area having a pointer to the thirdstorage area, replaces a corresponding section of the first storage areawith a pointer to the third storage area. The software may also includeexecutable code that, after replacing all of the particular sections ofthe first storage area, causes data to be copied from the third storagearea to the first storage area.

[0034] According further to the present invention, computer softwarerestores data in connection with a system that provides data in a firststorage area of a first type that contains sections of data and providesdata in a second storage area of a second type wherein the second typehas, for each section of data thereof, at least one of: a pointer to acorresponding section of data of the first storage area and a pointer tocorresponding section of data of a third storage area of the first type,and the software includes executable code that, for each particularsection of data of the second storage area having a pointer to the thirdstorage area, replaces a corresponding section of a fourth storage areaof the first type with the pointer to the third storage area, andexecutable code that, for each particular section of data of the secondstorage area having a pointer to the first storage area, replaces acorresponding section of the fourth storage area with a pointer to thefirst storage area. The computer software also includes executable codethat, after replacing all of the particular sections of the fourthstorage area, causes data to be copied from the first and third storageareas to the fourth storage area.

[0035] According further to the present invention. computer softwarerestores data in connection with a system that provides data in a firststorage area of a first type that contains sections of data and providesdata in a second storage area of a second type wherein the second typehas, for each section of data thereof, at least one of: a pointer to acorresponding section of data of the first storage area and a pointer tocorresponding section of data of a third storage area of the first type,and the software includes executable code that, for each particularsection of data of the second storage area having a pointer to the thirdstorage area, replacing a corresponding section of a fourth storage areaof the first type with a pointer to the third storage area, where thefourth storage area is at least a partial mirror copy of the firststorage area. The computer software also includes executable code that,after replacing all of the particular sections of the fourth storagearea, causes data to be copied from the third storage area to the fourthstorage area.

[0036] According further to the present invention, computer softwarerestores data in connection with a system that provides data in a firststorage area of a first type that contains sections of data and providesdata in a second storage area of a second type wherein the second typehas, for each section of data thereof, at least one of: a pointer to acorresponding section of data of the first storage area and a pointer tocorresponding section of data of a third storage area of the first typeand the software includes executable code that copies data from thesecond storage area to a third storage area of the second type.

BRIEF DESCRIPTION OF DRAWINGS

[0037]FIG. 1 is a diagram of a storage device used in connection withthe system described herein.

[0038]FIG. 2 is a diagram of a storage that shows various logicalvolumes that are used in connection with the system described herein.

[0039]FIG. 3 is a diagram showing use of a virtual device according tothe system described herein.

[0040]FIG. 4 is a diagram showing use of a plurality of virtual devicesaccording to the system described herein.

[0041]FIG. 5 is a diagram showing device tables used in connection withthe system described herein.

[0042]FIG. 6 is a flow chart illustrating reading a table used inconnection with a virtual device according to the system describedherein.

[0043]FIG. 7 is a flow chart illustrating writing to a table used inconnection with a virtual device according to the system describedherein.

[0044]FIG. 8 is a flow chart illustrating modification of a virtualdevice table and establishing a virtual device according to the systemdescribed herein.

[0045]FIG. 9 is a flow chart illustrating modification of datastructures used to handle tracks of a log device according to the systemdescribed herein.

[0046]FIG. 10 is a flow chart illustrating steps performed in connectionwith reading a virtual device according to the system described herein.

[0047]FIG. 11 is a flow chart illustrating steps performed by a diskadapter in connection with writing to a standard logical device to whicha virtual device has been established according to the system describedherein.

[0048]FIG. 12 is a flow chart illustrating steps performed by a hostadapter in connection with writing to a standard logical device to whicha virtual device has been established according to the system describedherein.

[0049]FIG. 13 is a flow chart illustrating steps performed in connectionwith writing to a virtual device according to the system describedherein.

[0050]FIG. 14 is a flow chart illustrating steps performed in connectionwith removing a virtual device.

[0051]FIGS. 15A, 15B, and 15C are flow charts illustrating modifyingprotection bits of tracks of a storage device according to an embodimentof the system described herein.

[0052]FIGS. 16A and 16B are portions of flow charts illustratingalternative processing for the flow charts of FIGS. 11 and 12,respectively, when protection bits are set according to the flow chartsof FIGS. 15A, 15B, and 15C.

[0053]FIG. 17 is a flow chart illustrating registering a standardlogical device/virtual device pair according to the system describedherein.

[0054]FIG. 18 is a flow chart illustrating relating a standard logicaldevice to a virtual device according to the system described herein.

[0055]FIG. 19A is a flow chart illustrating steps performed inconnection with activation of one or more standard logicaldevice/virtual device pairs according to the system described herein.

[0056]FIG. 19B is a flow chart illustrating steps performed inconnection with activation of one or more standard logicaldevice/virtual device pairs according to another embodiment of thesystem described herein.

[0057]FIGS. 20A, 20B, 20C, 20D, and 20E illustrate different ways torestore a virtual device to a standard logical device or another virtualdevice according to the system described herein.

[0058]FIG. 21 is a flow chart that illustrates steps performed torestore a virtual logical device to a standard logical device accordingto a first embodiment of the system described herein.

[0059]FIG. 22 is a flow chart that illustrates steps performed torestore a virtual logical device to a standard logical device accordingto a second embodiment of the system described herein.

[0060]FIG. 23 is a flow chart that illustrates steps performed torestore a virtual logical device to a split mirror standard logicaldevice according to a third embodiment of the system described herein.

[0061]FIG. 24 is a flow chart illustrating interconnects between hostsand a storage device according to the system described herein.

[0062]FIG. 25 is a flow chart illustrating a host application call toestablish a standard logical device/virtual device pair according to thesystem described herein.

[0063]FIG. 26 is a flow chart illustrating a host application call torestore a virtual device to a standard logical device according to thesystem described herein.

[0064]FIG. 27 is a flow chart illustrating deactivating a virtual deviceaccording to the system described herein.

[0065]FIG. 28 is a flow chart illustrating obtaining data fordeactivated from tracks of a deactivated virtual device according to thesystem described herein.

[0066]FIG. 29 is a flow chart illustrating steps performed in connectionwith providing a rolling back up according to the system describedherein.

[0067]FIG. 30 is a flow chart illustrating restoring data from a rollingback up according to the system described herein.

DETAILED DESCRIPTION OF VARIOUS EMBODIMENTS

[0068] Referring to FIG. 1, a storage device 30 includes a plurality ofhost adapters (HA) 32-34, a plurality of disk adapters (DA) 36-38 and aplurality of disk drives 42-44. Each of the disk drives 42-44 is coupledto a corresponding one of the DA's 36-38. The storage device 30 alsoincludes a global memory 46 that may be accessed by the HA's 32-34 andthe DA's 36-38. The storage device 30 also includes a RDF adapter (RA)48 that may also access the global memory 46. The RA 48 may communicatewith one or more additional remote storage devices (not shown) and/orone or more other remote devices (not shown) via a data link 52. TheHA's 32-34, the DA's 36-38, the global memory 46 and the RA 48 arecoupled to a bus 54 that is provided to facilitate communicationtherebetween.

[0069] Each of the HA's 32-34 may be coupled to one or more hostcomputers (not shown) that access the storage device 30. The hostcomputers (hosts) read data stored on 20 the disk drives 42-44 and writedata to the disk drives 42-44. The global memory 46 contains a cachememory that holds tracks of data from the disk drives 42-44 as well asstorage for tables that may be accessed by the HA's 32-34, the DA's36-38 and the RA 48. Note that, for the discussion herein, blocks ofdata are described as being a track or tracks of data. However, it willbe appreciated by one of ordinary skill in the art, that the systemdescribed herein may work with any appropriate incremental amount, orsection, of data, including possibly variable incremental amounts ofdata and/or fixed incremental amounts of data.

[0070] Referring to FIG. 2, the storage device 30 is shown as includinga plurality of standard logical devices 61-68. Each of the standardlogical devices 61-68 may correspond to a volume that is accessible toone or more hosts coupled to the storage device 30. Each of the standardlogical devices 61-68 may or may not correspond to one of the diskdrives 42-44. Thus, for example, the standard logical device 61 maycorrespond to the disk drive 42, may correspond to a portion of the diskdrive 42, or may correspond to a portion of the disk drive 42 and aportion of the disk drive 43. Each of the standard logical devices 61-68appears to the host as a contiguous block of disk storage, even thougheach of the standard logical devices 61-68 may or may not correspond toactual contiguous physical storage of the disk drives 42-44.

[0071] The storage device 30 may also includes a plurality of virtualdevices 71-74. The virtual devices 71-74 appear to a host coupled to thestorage device 30 as volumes containing a contiguous block of datastorage. Each of the virtual devices 71-74 may represent a point in timecopy of an entire one of the standard logical devices 61-68, a portionof one of the standard logical devices 61-68, or a combination ofportions or entire ones of the standard logical devices 61-68. However,as described in more detail elsewhere herein, the virtual devices 71-74do not contain the track data from the standard logical devices 61-68.Instead, each of the virtual devices 71-74 is coupled to a log device 76or a log device 78 that stores some or all the track data, as describedin more detail elsewhere herein. The virtual devices 71-74 containtables that point to tracks of data on either on the standard logicaldevices 61-68 or the log devices 76, 78.

[0072] The virtual device 71 may represent a point in time copy of thestandard logical device 61. As described in more detail elsewhereherein, the virtual device 71 is coupled to the log device 76 thatcontains track data to facilitate the virtual device 71 appearing to ahost to be a point in time copy of the standard logical device 61. It ispossible for more than one virtual device to use a single log device.Thus, the virtual devices 72-74 are shown being coupled to the logdevice 78. Similarly, it is possible for more than one virtual device torepresent point in time copies of a single standard logical device.Thus, the virtual devices 72,73 are shown as being point in time copiesof the standard logical device 64. The virtual devices 72,73 mayrepresent the same point in time copy of the standard logical device 64or, alternatively, may represent point in time copies of the standardlogical device 64 taken at different times. Note that only some of thestandard logical devices 61-68 are shown as being associated with acorresponding one of the virtual devices 71-74 while others of thestandard logical devices 61-68 are not.

[0073] In some embodiments, it may be possible to implement the systemdescribed herein using storage areas, instead of storage devices. Thus,for example, the virtual devices 71-74 may be virtual storage areas, thestandard logical devices 61-68 may be standard logical areas, and thelog devices 76,78 may be log areas. In some instances, such animplementation may allow for hybrid logical/virtual devices where asingle logical device has portions that behave as a standard logicaldevice, portions that behave as a virtual device, and/or portions thatbehave as log device. Accordingly, it should be understood that, inappropriate instances, references to devices in the discussion hereinmay also apply to storage areas that may or may not correspond directlywith a storage device.

[0074] Referring to FIG. 3, a diagram shows a standard logical device82, a virtual device 84, and a log device 86. As discussed above, thevirtual device 84 may represent a point in time copy of all or a portionof the standard logical device 82. A host coupled to a storage devicethat accesses the virtual device 84 may access the virtual device 84 inthe same way that the host would access the standard logical device 82.However, the virtual device 84 does not contain any track data from thestandard logical device 82. Instead, the virtual device 84 includes aplurality of table entries that point to tracks on either the standardlogical device 82 or the log device 86.

[0075] When the virtual device is established 84 (e.g., when a point intime copy is made of the standard logical device 82), the virtual device84 is created and provided with appropriate table entries that, at thetime of establishment, point to tracks of the standard logical device82. A host accessing the virtual device 84 to read a track would readthe appropriate track from the standard logical device 82 based on thetable entry of the virtual device 84 pointing to the track of thestandard logical device 82.

[0076] After the virtual device 84 has been established, it is possiblefor a host to write data to the standard logical device 82. In thatcase, the previous data that was stored on the standard logical device82 is copied to the log device 86 and the table entries of the virtualdevice 84 that previously pointed to tracks of the standard logicaldevice 82 would be modified to point to the new tracks of the log device86 to which the data had been copied. Thus, a host accessing the virtualdevice 84 would read either tracks from the standard logical device 82that have not changed since the virtual device 84 was established or,alternatively, would read corresponding tracks from the log device 86that contain data copied from the standard logical device 82 after thevirtual device 84 was established. Adjusting data and pointers inconnection with reads and writes to and from the standard logical device82 and virtual device 84 is discussed in more detail elsewhere herein.

[0077] In an embodiment described herein, hosts would not have directaccess to the log device 86. That is, the log device 86 would be usedexclusively in connection with the virtual device 84 (and possibly othervirtual devices as described in more detail elsewhere herein). Inaddition, for an embodiment described herein, the standard logicaldevice 82, the virtual device 84, and the log device 86 may be providedon the single storage device 30. However, it is possible to provide thedifferent logical devices and the log device on separate storage devicesinterconnected using, for example, the RDF protocol or other remotecommunication protocols. In addition, it may be possible to haveportions of one or more of the standard logical device 82, the virtualdevice 84, and/or the log device 86 provided on separate storage devicesthat are appropriately interconnected.

[0078] Referring to FIG. 4, another example of the use of virtualdevices shows a standard logical device 92, a plurality of virtualdevices 94-97 and a log device 98. In the example of FIG. 4, the virtualdevice 94 represents a point in time copy of the standard logical device92 taken at ten a.m. Similarly, the virtual device 95 represents a copyof the standard logical device 92 taken at twelve noon, the virtualdevice 96 represents a copy of the standard logical device 92 taken attwo p.m., and the virtual device 97 represents a copy of the standardlogical device 92 taken at four p.m. Note that all of the virtualdevices 94-97 may share the log device 98. In addition, it is possiblefor table entries of more than one of the virtual devices 94-97, or, asubset of the table entries of the virtual devices 94-97, to point tothe same tracks of the log device 98. For example, the virtual device 95and the virtual device 96 are shown as having table entries that pointto the same tracks of the log device 98.

[0079] In an embodiment discussed herein, the log device 98 and otherlog devices discussed herein are provided by a pool of log devices thatis managed by the storage device 30. In that case, as a virtual devicerequires additional tracks of a log device, the virtual device wouldcause more log device storage to be created (in the form of more tracksfor an existing log device or a new log device) using the log devicepool mechanism. Pooling storage device resources in this manner is knownin the art. Other techniques that do not use pooling may be used toprovide log device storage.

[0080] Referring to FIG. 5, a diagram 100 illustrates tables that areused to keep track of device information. A first table 102 correspondsto all of the devices used by a storage device or by an element of astorage device, such as an HA and/or a DA. The table 102 includes aplurality of logical device entries 106-108 that correspond to all thelogical devices used by the storage device (or portion of the storagedevice). The entries in the table 102 include descriptions for standardlogical devices, virtual devices, log devices, and other types oflogical devices.

[0081] Each of the entries 106-108 of the table 102 correspond toanother table that contains information for each of the logical devices.For example, the entry 107 may correspond to a table 112. The table 112includes a header that contains overhead information. The table 112 alsoincludes entries 116-118 for each of the cylinders of the logicaldevice. In an embodiment disclosed herein, a logical device may containany number of cylinders depending upon how the logical device isinitialized. However, in other embodiments, a logical device may containa fixed number of cylinders.

[0082] The table 112 is shown as including a section for extra trackbytes 119. The extra track bytes 119 are used in connection with the logdevices in a manner that is discussed elsewhere herein. In an embodimentdisclosed herein, there are eight extra track bytes for each track of alog device. For devices that are not log devices, the extra track bytes119 may not be used.

[0083] Each of the cylinder entries 116-118 corresponds to a tracktable. For example, the entry 117 may correspond to a track table 122that includes a header 124 having overhead information. The track table122 also includes entries 126-128 for each of the tracks. In anembodiment disclosed herein, there are fifteen tracks for everycylinder. However, for other embodiments, it may be possible to havedifferent numbers of tracks for each of the cylinders or even a variablenumber of tracks for each cylinder. For standard logical devices and logdevices, the information in each of the entries 126-128 includes apointer (either direct or indirect) to the physical address on one ofthe disk drives 42-44 of the storage device 30 (or a remote storagedevice if the system is so configured). Thus, the track table 122 may beused to map logical addresses of the logical device corresponding to thetables 102, 112, 122 to physical addresses on the disk drives 42-44 ofthe storage device 30. For virtual devices, each of the entries 126-128of the table 122 points to a track of a corresponding standard logicaldevice or corresponding log device. For other embodiments, however, itmay be possible to use a different mechanism where the tables 102, 122,122 are used only for standard logical devices that contain tracks ofdata while another type of table, such as a simple array of tracks, isused by virtual devices to map tracks of the virtual devices to tracksof corresponding standard logical devices or log devices.

[0084] Each track of a log device is either free, meaning that it is notbeing used by a virtual device, or is assigned, meaning that the trackis pointed to by a table entry in one or more of the virtual devices. Inan embodiment disclosed herein, the tracks of a log device are managedby first creating a doubly linked list of all of the free tracks of thelog device. The pointers for the doubly linked list are provided by theextra track bytes 119 of the table 112 so that the extra track bytes 119for a log device contains eight bytes for every track of the log device.For every track of the log device that is free, the extra eight bytesinclude a forward pointer pointing to the next free track of the logdevice and a backward pointer pointing to the previous free track of thelog device. Using a doubly linked list in this manner facilitatesaccessing free tracks of the log device.

[0085] In addition, if a track of a log device is assigned (i.e., isused by one or more virtual devices), the corresponding extra trackbytes 119 for the track may be used to point back to the correspondingtrack of the standard logical device. Thus, when a write is performed tothe standard logical device after the virtual device has beenestablished, the data from the standard logical device is copied to anew track of the log device and the extra track bytes corresponding tothe new track of the log device are made to point back to the track ofthe standard logical device from which the data came. Having each trackof the log device point back to the corresponding track of the standardlogical device is useful in, for example, data recovery situations.

[0086] In addition, for an embodiment disclosed herein, the pointers forthe extra eight bytes per track for an assigned track are stored withthe data also. That is, when a particular track of a log device isassigned, the pointer back to the corresponding track of a standardlogical device is stored with the extra track bytes 119 and, inaddition, the pointer is stored with the track data itself on the trackof the log device. For CKD formatted tracks, the extra eight bytes maybe stored in block zero. For FBA formatted tracks, the extra eight bytesmay be stored in an additional block appended on the end of the track.In an embodiment disclosed herein, a block is five hundred and twelvebytes and an FBA track contains forty blocks, which is increased toforty-one when an additional block is appended. Different track formatsare disclosed, for example, in U.S. Pat. No. 5,206,939 to Yanai, et al.,which is incorporated herein by reference.

[0087] The tables 102, 112, 122 of FIG. 5 may be stored in the globalmemory 46 of the storage device 30. In addition, the tablescorresponding to devices accessed by a particular host may be stored inlocal memory of the corresponding one of the HA's 32-36. In addition,the RA 48 and/or the DA's 36-38 may also use and locally store portionsof the tables 102, 112, 122.

[0088] Referring to FIG. 6, a flow chart 140 illustrates steps performedwhen a host reads data from a device table corresponding to a track thatis accessible through a virtual device. That is, the flow chart 140illustrates obtaining information about a track that is pointed to by atable entry for a virtual device.

[0089] Processing begins at a test step 142 where it is determined ifthe track of interest (i.e., the track corresponding to the table entrybeing read) is on the standard logical device or the log device. This isdetermined by accessing the device table entry for the virtual deviceand determining whether the table entry for the track of interest pointsto either the standard logical device or the log device. If it isdetermined at the test step 142 that the pointer in the table for thevirtual device points to the standard logical device, then controlpasses from the step 142 to a step 148 where the table entry of interestis read. Following the step 148, processing is complete.

[0090] If it is determined that the test step 142 that the pointer inthe device table for the virtual device for the track of interest pointsto the log device, then control transfers from the step 142 to a step158 where the log table entry of interest is read. Following the step158, processing is complete.

[0091] Note that, in some instances, access to data may be controlled bya flag or lock that prohibits multiple processes having access to thedata simultaneously. This is especially useful in instances where adevice table is being read or modified. The system disclosed hereincontemplates any one of a variety of mechanisms for controlling accessto data by multiple processes, including conventional combinations ofsoftware and/or hardware locks, also known as “flags” or “semaphores”.In some instances, a process accessing data may need to wait untilanother process releases the data. In one embodiment, a hardware lockcontrols access to a software lock (flag) so that a process firstobtains control of the hardware lock, tests the software lock, and then,if the software lock is clear, the process sets the software lock andthen releases the hardware lock. If the process gets the hardware lockand determines that the software lock is not clear, then the processreleases the hardware lock so that another process that has set thesoftware lock can clear the software lock at a later time. Further notethat, in some instances, it is useful to first read a table entrycorresponding to a particular track, read the track into a cache slot(if the track is not already in cache), lock the cache slot, and thenreread the corresponding table entry.

[0092] Referring to FIG. 7, a flow chart 170 illustrates steps performedin connection with writing information to a device table for a virtualdevice corresponding to a standard logical device or a log device.Processing begins at a first step 172 where it is determined if theparticular track corresponding to the device table entry being writtenis on the standard logical device or the log device. If it is determinedthe particular track of interest is on the standard logical device,control passes from the step 172 to a step 178 where the trackcorresponding to the device table entry being written is locked. Lockingthe track at the step 178 prevents other processes from getting accessto the track, and from modifying the corresponding table entry, whilethe current process is modifying the device table entry corresponding tothe track. Following the step 178 is a step 182 where the writeoperation is performed. Following the step 182 is a step 184 where thetrack is unlocked. Following the step 184, processing is complete.

[0093] If it is determined that the test step 172 that the trackcorresponding to the table entry for the virtual device that is beingmodified points to the log device, then control passes from the teststep 172 to a step 194 where the track of the log device correspondingto the entry of the device table that is being written is locked.Following the step 194 is a step 196 where the write operation isperformed. Following the step 196 is a step 198 where the track isunlocked. Following the step 198, processing is complete.

[0094] Referring to FIG. 8, a flow chart 210 illustrates steps performedin connection with modifying a device table corresponding to a virtualdevice. This may be contrasted with the flow chart 170 of FIG. 7 thatillustrates modifying the device table for the standard logical deviceor the log device pointed to by an entry for a track of the device tablefor a virtual device. In flow chart 210, the device table for thevirtual device is modified, as opposed to the device table for thestandard logical device or the device table for the log device.

[0095] Processing begins at a first step 212 where it is determined ifthe modifications to the table relate to establishing the virtualdevice. As discussed elsewhere herein, establishing a virtual deviceincludes making the virtual device available for access by a host afterthe virtual device is created. Establishing a virtual device causes thevirtual device to be associated with a standard logical device (andthus, represent a point in time copy of the standard logical device atthe time of establishment). Prior to being associated with a standardlogical device, a virtual device is not established and is notaccessible by a host. After being established, a virtual device isaccessible by a host.

[0096] If it is determined at the step 212 that the modifications to thetable relate to establishing the virtual device, then control passesfrom the step 212 to a step 214 where a device lock for the virtualdevice is set to prohibit access to the table by other processes. Thedevice lock is comparable to the cache slot lock, discussed elsewhereherein.

[0097] Following the step 214 is a step 216 where the pointers of thevirtual device table are made to point to tracks of the standard logicaldevice and where a protection bit is set for each of the tracks of thestandard logical device that corresponds to the virtual device beingestablished. In an embodiment disclosed herein, each of the tracks ofthe standard logical device has sixteen bits which may be set asprotection bits, one for each virtual device established to the standardlogical device. In some embodiments, the protection bits may have usesthat are unrelated to virtual devices. A new virtual device beingestablished may be assigned a new bit position in the sixteen bit fieldwhile the bit for each track of the standard logical device may be set.As discussed in more detail elsewhere herein, the protection bit beingset followed by a subsequent write to the standard logical deviceindicates that special processing needs to take place to accommodate thevirtual device established to the standard logical device. The specialprocessing is described in more detail elsewhere herein. Also at thestep 216, the track entries for the device table for the virtual deviceare all modified to point to the corresponding tracks of the standardlogical device. Thus, when the virtual device is first established, allof the pointers of the device table of the virtual device point to thetracks of the standard logical device.

[0098] Following the step 216 is a step 217 the virtual device is set tothe ready state, thus making the virtual device accessible to hosts.Following the step 217 is a step 218 where the virtual device isunlocked, thus allowing access by other processes. Following the step218, processing is complete.

[0099] If it is determined that the test step 212 that the virtualdevice is not being established (i.e., some other operation is beingperformed), then control passes from the test step 212 to a step 222 tolock a track corresponding to the entry of the device table for thevirtual device that is being modified. Note that the track that islocked at the step 222 may either be a track on the standard logicaldevice (if the entry of interest in the device table of the virtualdevice points to the standard logical device) or a track of the logdevice (if the entry of interest points to the log device). Followingthe step 222 is a step 224 where the modification to the device tablefor the virtual device is performed.

[0100] Following the step 224 is a step 226 where the track is unlocked.Following the step 226, processing is complete.

[0101] Referring to FIG. 9, a flow chart 230 illustrates steps performedin connection with manipulating tracks of a log device. As discussedabove, the tracks of a log device are maintained by creating a doublylinked list of tracks of the log device that are free (i.e. tracks thatare available for accepting new data). Thus, if one or more tracks areneeded for use in connection with a corresponding virtual device, thefree tracks are obtained from the doubly linked list, which is modifiedin a conventional manner to indicate that the tracks provided for use bythe virtual device are no longer free. Conversely, if one or more tracksthat are used by one or more virtual devices are no longer needed, thetracks are returned to the doubly linked list, in a conventional manner,in order to indicate that the tracks are free. The flow chart 230 ofFIG. 9 illustrates the steps performed in connection with controllingaccess to the tracks (and track pointers) by multiple processes whichmanipulate the tracks.

[0102] Processing begins at a test step 232 where it is determined ifthe operation being performed is modifying only tracks that are on thefree list. Note that modifying tracks only on the free lists by, forexample, transferring a free track from one part of the list to anotherpart or from one free lists to another free list (in the case ofmultiple free lists), does not involve modifications for trackscorresponding to any data. If it is determined at the test step 232 thatthe modification being performed does not involve only tracks on thefree list, then control transfers from the step 232 to a step 234 wherethe track is locked to prevent access by other processes.

[0103] Following the step 234 or the step 232 if the step 234 is notreached is a test step 236 where it is determined if the manipulationinvolves only allocated tracks. For any operation involving onlyallocated tracks, it is not necessary to lock the log device list offree tracks. If it determined at the step 236 that the operation beingperformed is not manipulating only allocated tracks, then controltransfers from the step 236 to the step 238 where the log device list offree tracks is locked to prevent access by other processes.

[0104] Following the step 238, or following the step 236 if the step 238is not executed, is a step 242 where the modification is performed.

[0105] Following the step 242 is a test step 244 where it is determinedif the manipulation involves only allocated tracks. If it is determinedat the test step 244 that the modification being performed does notinvolve only allocated tracks, then control transfers from the step 244to a step 246 where the log device free list is unlocked.

[0106] Following the step 246 or the step 244 if the step 246 is notreached is a test step 248 where it is determined if the operation beingperformed is modifying only tracks that are on the free list. If itdetermined at the step 248 that the operation being performed ismodifying only tracks that are on the free list, then control transfersfrom the step 248 to the step 252 where the track or tracks locked atthe step 234 are unlocked. Following the step 252, or following the step248 if the step 252 is not executed, processing is complete.

[0107] Referring to FIG. 10, a flow chart 280 illustrates stepsperformed in connection with reading data from a virtual device.Processing begins at a test step 282, where it is determined if thedevice table entry for the track of interest of the virtual devicepoints to the standard logical device or points to the log device. If itis determined at the test step 282 that the table points to the standardlogical device, then control passes from the step 282 to a step 284,where the track is read from the standard logical device. Following thestep 284, processing is complete. Alternatively, if it determined at thetest step 282 that the device table of the virtual device points to thelog device, then control passes from the step 282 to a step 286, wherethe track of interest is read from the log device. Following the step286, processing is complete.

[0108] Note that in some instances, it may be possible that prior to thetest step 282, it is determined that the track of interest being read isalready in the cache memory (global memory). In that case, the track maybe obtained from the cache memory without executing any of the steps282, 284, 286.

[0109] Referring to FIG. 11, a flow chart 300 illustrates stepsperformed by a DA in connection with writing to a track of a standardlogical device to which a virtual device has been previouslyestablished. Processing begins at a first step 302 where it isdetermined if any protection bits for the track being written on thestandard logical device have been set. If it determined at the test step302 that the protection bits are not set, then control transfers fromthe step 302 to a step 304, where a normal write operation is performed.That is, at the step 304, data is written to the standard logical devicein a conventional fashion without regard to the existence of a virtualdevice that had been previously established to the standard logicaldevice. Following the step 304, processing is complete.

[0110] If it is determined at the test step 302 that one or moreprotection bits have been set on the track of the standard logicaldevice that is being written, control passes from the step 302 to a step306, where a free track of the log device is obtained. The free track ofthe log device is needed to copy data from the track of the standardlogical device. Also, as described in more detail elsewhere herein, freetracks of the log device may be managed using a doubly-linked list ofthe free tracks. Thus, at the step 306, it may be possible to obtain afree track by traversing the list of free tracks of the log device andmodifying the pointers appropriately to remove one of the free tracksfor use.

[0111] Following the step 306 is a step 308, where, for each virtualdevice that corresponds to a protection bit that was determined to beset at the test step 302, the pointers of the virtual devices, whichinitially pointed to the track being written on the standard logicaldevice, are modified at the step 308 to point to the free track of thelog device obtained at the step 306. As discussed above, it is possibleto have more than one virtual device established to a standard logicaldevice. For each virtual device that has been established to aparticular standard logical device, a specific protection bit will beset for each of the tracks of the standard logical device. Thus, at thestep 308, the track pointers are changed for all the virtual devicescorresponding to a set protection bit detected at the step 302. Thetrack pointers in the device tables of virtual devices are modified topoint to the new track that was obtained at the step 306.

[0112] Following the step 308 is a step 312, where the data is caused tobe copied from the standard logical device to the new track on the logdevice that was obtained at the step 306. In an embodiment disclosedherein, the data may be copied by moving the data from disk storage tothe global memory of the storage device (e.g., into a cache slot), andthen setting a write pending indicator to cause the data to be copied tothe track of the log device obtained at the step 306. The step 312represents copying the data from the track of the standard logicaldevice that is being written to the new track of the log device obtainedat the step 306. Since all the pointers are modified at the step 308,any virtual device that has been established to the standard logicaldevice prior to the track being written now points to the old data(i.e., the data as it existed on the track of the standard logicaldevice when the virtual devices were established). Note also that, inconnection with copying the track, the protection bits of the standardlogical device track are copied to virtual device map bits for the trackon the log device, which is explained in more detail elsewhere herein.

[0113] Following the step 312 is a step 314, where the track of the logdevice obtained at the step 306 is modified so that the extra bytes inthe table (discussed elsewhere herein) are made to point back to thetrack of the standard logical device that is being written. Having thetrack of the log device point to the corresponding track of the standardlogical device from which the data was provided is useful in manyinstances. For example, it may be useful in connection with datarecovery. Following the step 314 is a step 316, where the protectionbits of the tracks of the standard logical device being written arecleared. Following the step 316 is a step 318, where status is sent tothe HA. Following the step 318, processing is complete.

[0114] Note that once the HA receives status, the HA may perform anormal write operation and, in that case, at the test step 302, theprotection bits will not be set, since the bits are cleared at the step316. The HA that is performing the write operation sees the protectionbits that are set at the step 302 and sends a protection request to theappropriate DA. The HA then may disconnect from the DA and wait forstatus to arrive from the DA indicating that a normal write may beperformed. While the HA is disconnected and waiting for status from theDA, the DA may perform the steps disclosed in the flow chart 300. Thisis described in more detail below.

[0115] Referring to FIG. 12, a flow chart 320 illustrates stepsperformed by an HA in connection with a write to a standard logicaldevice to which one or more virtual devices have been established.Processing begins at a first test step 322, where it is determined ifany protection bits are set for the tracks of the standard logicaldevice that are being written. If it is determined at the test step 322that no protection bits are set, then control passes from the step 322to a step 324, where a normal write is performed. Following the step324, processing is complete.

[0116] If it is determined at the test step 322 that one or moreprotection bits are set for the tracks of the standard logical devicethat are being written, control passes from the step 322 to a step 326,where the HA sends a request to the DA indicating that protection bitsare set for the tracks. When the DA receives the request that is sent atthe step 326, the DA performs the operations set forth in the flow chart300 of FIG. 11, discussed above. Following the step 326 is a step 328,where the HA disconnects from the DA in order to allow (possiblyunrelated) operations to be performed with the DA by other processesand/or other HA's.

[0117] Following the step 328 is a step 332, where the HA waits for theDA to perform the operations set forth in the flow chart 300 of FIG. 11and to send status to the HA indicating that the appropriate steps havebeen performed to handle the set protection bits. Following the step332, processing transfers back to the step 322, where the protectionbits for the track of the standard logical device are again tested. Notethat on a second iteration, it is expected that the protection bits ofthe track of the standard logical device that are being written would beclear at the step 322, since the DA would have cleared the protectionbits in connection with performing the steps of the flow chart 300. Ofcourse, it is always possible that a new virtual device will beestablished to the standard logical device in between the DA clearingthe protection bits and the step 322 being executed again. However, itis usually expected that the second iteration of the step 322 for aparticular track of the standard logical device will determine that allthe protection bits are clear, and control will transfer from the step322 to the step 324 to perform a normal write.

[0118] Referring to FIG. 13, a flow chart 340 illustrates stepsperformed in connection with writing to a virtual device. The flow chart340 represents steps performed by both the HA and the DA and thus couldhave been provided as two flow charts, similar to the flow chart 300 ofFIG. 11 and the flow chart 320 of FIG. 12. However, it will beunderstood by those of ordinary skill in the art that the flow chart 340may represent a division of steps similar to those set forth in the flowcharts 300, 320 and described in the corresponding portions of the textof the specification.

[0119] Processing begins at a first step 342, where it is determined ifthe virtual device points to the standard logical device. If so, thencontrol transfers from the test step 342 to a step 344, where a freetrack of the log device is obtained. Following the step 344 is a step346, where data from the standard logical device corresponding to thetrack being written is caused to be copied from the standard logicaldevice to the track of the log device obtained at the step 344.Following the step 346 is a step 348, where the virtual device pointerfor the track is adjusted to point to the track obtained at the step344. Following the step 348 is a step 352, where a protection bitcorresponding to the virtual device is cleared in the track data of thestandard logical device, thus indicating that no special processing onbehalf of the virtual device is required when writing to the track ofthe standard logical device. Following the step 352 is a step 354, wherethe write is executed. At the step 354, the data to be written may be atrack or a portion of a track that is written to the track obtained atthe step 344. Following the step 354, processing is complete. If thedata corresponds to an entire track, then it may be possible toeliminate the step 346, which copies data from the track of the standardlogical device to the new track of the log device, since writing anentire track's worth of data at the step 354 would overwrite all of thedata copied at the step 346.

[0120] If it is determined at the test step 342 that the pointer for thetrack of the virtual devices being written does not point to thestandard logical device, then control transfers from the step 342 to atest step 356, where it is determined if more than one virtual deviceshave been established to the standard logical device. If not, thencontrol transfers from the step 356 to a step 358, where a normal writeoperation to the track of the log device is performed. If it isdetermined at the test step 356 that there is more than one virtualdevice established to the standard logical device, then controltransfers from the step 356 to a step 362, where a free track from thelog device is obtained.

[0121] Following the step 362 is a step 364, where the data of the trackcorresponding to the virtual device being written is copied to the trackobtained at the step 362. Following the step 364 is a step 366, wherethe virtual device pointers are adjusted to point to the new track. Inone embodiment, the pointer for the virtual device that is being writtenis made to point to the new track. Alternatively, it is possible to notchange the pointer for the virtual device that is being written and,instead, adjust all the pointers for all of the other virtual devicesthat point to the track at the step 366.

[0122] Following the step 366 is a step 368 where the virtual device mapbits for the tracks of the log device are modified. For the log devicetracks, the virtual device map bits may be used to indicate whichvirtual devices point to each track, where, in one embodiment, there aresixteen virtual device map bits and each bit corresponds to a particularvirtual device. Thus, the test at the step 356 may examine the virtualdevice map bits for the track.

[0123] Following the step 368 is a step 369, where the write isexecuted. Note that whether the write is executed to the track obtainedat the step 362 or to the track that is initially pointed to by thevirtual device being written depends upon how the pointers are adjustedat the step 366. In all cases, however, data is written to the trackpointed to by the virtual device to which the data is being written.Following the step 369, processing is complete.

[0124] Referring to FIG. 14, a flow chart 370 illustrates stepsperformed in connection with removing (i.e., eliminating) a virtualdevice. Once a virtual device has been established and used for itsintended purpose, it may be desirable to remove the virtual device.Processing begins at a first step 372, where a pointer is set to pointto the first track of the virtual device. The virtual device is removedby examining each track corresponding to the virtual device.

[0125] Following the step 372 is a step 374, where it is determined ifthe track of the virtual device that is being examined points to thestandard logical device. If so, then control transfers from the step 374to a step 376 to clear the protection bit on the track of the standardlogical device corresponding to the virtual device being removed.Following the step 376 is a step 378, where a pointer points to the nexttrack of the virtual device in order to continue processing by examiningthe next track. Following the step 378 is a step 382, where it isdetermined if processing complete (i.e., all the tracks of the virtualdevice have been processed). If not, then control transfers from thestep 382 back to the test step 374, discussed above.

[0126] If it is determined at the test step 374 that the track of thevirtual device being examined does not point to the standard logicaldevice, then control transfers from the step 374 to a step 384, where avirtual device map bit on the track of the log device that correspondsto the virtual device being removed is cleared. Each track of the logdevice may have a set of virtual device map bits indicating whichvirtual devices use the track of the log device. Thus, at the step 384,the virtual device map bit corresponding to the virtual device beingremoved is cleared.

[0127] Following the step 384 is a test step 386, where it is determinedif the bit that was cleared at the step 384 was the last virtual devicemap bit that was set for the track. In other words, the test step 386determines if there are other virtual devices that are using the trackon the log device. If it is determined at the test step 386 that thelast virtual device map bit was cleared at the step 384 (and thus, noother virtual devices use the track), then control transfers from thestep 386 to a step 388, where the track of the log device is returned tothe free list of tracks of the log device, discussed elsewhere herein.Following the step 388, or following the step 386 if it is determinedthat the bit cleared at the step 384 is not the last virtual device mapbit of the track of the log device, is the step 378, discussed above,where the next track of the virtual device is pointed to for subsequentexamination. Once all of the tracks corresponding to the virtual devicehave been processed, the tables and other data structures associatedwith the virtual device may also be removed although, in someembodiments, the tables and other data structures from the virtualdevice may be maintained, so long as the virtual device is not madeavailable for use by hosts after the virtual device is deestablished.

[0128] In some embodiments, the virtual device may be made not ready tohosts prior to performing the steps illustrated by the flow chart 370.Alternatively, it may be possible to perform the steps illustrated bythe flow chart 370 while the virtual device is ready to hosts and tosimply issue an error message to any host that attempts to access thevirtual device while the steps of the flow chart 370 are being performedand/or to any host attempting to access a track of the virtual devicethat has already been destroyed (i.e., returned to the list of freetracks).

[0129] Any one of a variety of techniques may be used for setting theprotection bits on the tracks of the standard logical device at the step216 of FIG. 8. For example, the protection bits for the tracks of thestandard logical device may be set by locking the entire standardlogical device (thus prohibiting any other access to the standardlogical device) while all of the protection bits are being set. However,locking the entire standard logical device while all of the protectionbits are being set may be unacceptable in certain instances.Accordingly, other techniques, described below, are available to set theprotection bits in a way that does not necessarily cause the standardlogical device to be inaccessible for as long as it takes to set all ofthe protection bits for all of the tracks.

[0130] Referring to FIGS. 15A, 15B, and 15C, flow charts 400, 410, 420illustrates steps performed in connection with a technique for settingprotection bits of a standard logical device. The flow charts 400, 410,420 are shown separately to illustrate that different parts of theprocess may be performed separately.

[0131] In the first flow chart 400 of FIG. 15A, processing begins at afirst step 404, where a session number is obtained to reserve aparticular session. In some embodiments, reserving a session number maybe referred to as “attaching a session”. In an embodiment disclosedherein, each particular session number corresponds to a particular bitposition of a protection bit mask (i.e., corresponds to a particularprotection bit). Following the step 404, processing is complete. In someembodiments where multiple processes may attempt to obtain a sessionnumber simultaneously, it may be necessary to provide additionalfunctionality so that no two processes obtain the same session number.This functionality may be provided, for example, by locking the sessionresources (using software locks, hardware locks, or both) prior toobtaining the session number and then unlocking after obtaining thesession number. Of course, other techniques exist and may be used toprovide that the step 404 returns a unique session number to any processthat requests a session number, even if multiple processes arerequesting a session number at the same time.

[0132] Referring to FIG. 15B, the flow chart 410 illustrates steps forestablishing a session to an inactive state and setting the protectionbits. Processing begins at a first step 412, where the calling processis provided with exclusive access to the standard logical device (or atleast to the portions the standard logical device relating to theoperations that follow). In some instances, it is useful to provide acalling process with exclusive access to the resources being manipulatedbecause simultaneous (or near simultaneous) accesses by multipleprocesses could cause improper operation. Thus, at the step 412 and inother instances throughout this application, exclusive access is givento a calling process. In addition, the mechanism for providing exclusiveaccess could include any one of a variety of techniques, such ashardware locks, software locks (e.g., of system level data), timeslicing, etc. Of course, in embodiments where there can only be onepossible calling process (e.g., a non-multitasking system), it may notbe necessary to perform any processing like that illustrated in the step412 to enable exclusive access to a calling process.

[0133] Following the step 412 is a step 414 where the session (reservedpreviously at the step 404, discussed above) is established to aninactive state. In an embodiment herein, establishing the session to aninactive state involves moving a first value to a location in the headerof the device table for the standard logical device. As discussed above,FIG. 5 shows the header field 114 in the device table 112. The headerfield 114 can contain various data locations, each of which correspondsto one of the protection bits (i.e., where each bit position correspondsto a particular session number). A value placed at each of the locationsindicates the operation to be performed when a write occurs to a trackhaving the corresponding one of the protection bits set. For example,there may be sixteen byte-length data locations in the header field 114,where each data location corresponds to one of sixteen possibleprotection bits (e.g., byte zero corresponds to protection bit zero,byte one corresponds to protection bit one, etc.). At the step 414, afirst value is provided to one of the locations of the header field 114to set the corresponding session to an inactive state.

[0134] Setting the session to an inactive state at the step 414 causesno operations to be performed when the corresponding protection bit isset. Thus, when a write occurs to a track where the protection bit isset, the code that handles management of protection bits will fetch thecorresponding data from the device header, which in this case willindicate that the corresponding session is in an inactive state. Inresponse to this, the code that handles management of protection bitswill leave the protection bit set and will perform no other operations.The utility of this is discussed elsewhere herein.

[0135] Following the step 414 is a step 416 where the exclusive accessprovided at the step 412 is disabled. Disabling exclusive access at thestep 416 allows multiple processes simultaneous access to the resourcesto which exclusive access was provided at the step 412. In someembodiments, disabling exclusive access at the step 416 simply undoeswhatever was done at the step 412 (e.g., unlocking locked resources).

[0136] Following the step 416 is a step 418 where the correspondingprotection bit is set for each of the tracks corresponding to thelocation of the header field 114 for the session number that wasobtained at the step 404. Note that access by multiple process isprovided to the standard logical device while the step 418 is performed.However, since the corresponding session is inactive, then any writes totracks having a bit set at the step 418 that occur while the step 418 isbeing performed will result in no operations being performed and theprotection bit remaining set. Following step 418, processing iscomplete. Note that the step 418 of setting the protection bits may beperformed any time after the session is made inactive (and before thesession is made active, discussed below). Thus, the step 418 does notnecessarily need to immediately follow the steps performed to make thesession inactive.

[0137] In some embodiments, it may not be necessary to enable/disableexclusive access to the resources of the standard logical device. Forexample, if establishing the session to an inactive state at the step414 may be performed in a single unitary step (e.g., one uninterruptiblewrite operation), it may not be necessary to execute the steps 412, 416.This is illustrated by alternative paths 419 a, 419 b shown in the flowchart 410.

[0138] Referring to FIG. 15C, the flow chart 420 illustrates stepsperformed to activate a session. Processing begins at a first step 422where exclusive access to the standard logical device is enabled (likein the step 412, discussed above), thus preventing access thereto byanother process. Following the step 422 is a step 424 where the sessionis made active by, for example, writing a second value to the headerfield 114 of the table for the standard logical device. The second valueis provided in the same location as the first value and overwrites thefirst value. The second value indicates the special processing that isto be performed in connection with the corresponding protection bitbeing set. Such special processing is shown, for example, in FIGS. 11and 12 which illustrate special processing for virtual devices.

[0139] Following the step 424 is a step 426 where exclusive access tothe standard logical device is disabled. Following the step 426, anysubsequent writes to tracks having a set protection bit will cause thespecial operation to be performed as indicated by the second valueprovided to the header field 114 of the device table for the standardlogical device. For example, if the second value provided at the step424 indicates that the corresponding track should be copied to a logdevice, that is the operation that will be performed in connection witha write to a track with a set protection bit. Of course, the secondvalue provided at the step 424 can indicate any one of a number ofspecial processes to be performed in connection with the protection bitfor the track being set, such as, for example, processing to beperformed in connection with a snap operation. Following the step 426,processing is complete.

[0140] Just as with the flow chart 410, discussed above, in someembodiments, it may not be necessary to enable/disable exclusive accessto the resources of the standard logical device used in connection withthe step 424. For example, if establishing the session to an activestate at the step 424 may be performed in a single unitary step (e.g.,one write operation), it may not be necessary to execute the steps 422,426. This is illustrated by alternative paths 428 a, 428 b shown in theflow chart 420.

[0141] Referring to FIG. 16A, a portion of a flow chart 300′ shows stepsthat correspond to steps of the flow chart 300 of FIG. 11. The steps ofthe flow chart 300′ are modified to account for the use of theprotection bit scheme illustrated in FIGS. 15A, 115B, and 15C anddescribed above. A pair of steps 302′, 302″ replace the step 302 of theflow chart 300 of FIG. 11. The step 302′ is a test step like the step302 where it is determined if the protection bit for the track beingwritten to is set. If not, then control passes from the step 302′ to thestep 304, discussed above in connection with FIG. 11, where a normalwrite is performed. Following the step 304, processing is complete.

[0142] If it is determined at the test step 302′ that the protection bitof the track being written to is set, control passes from the step 302′to the test step 302″ where it is determined if the correspondingsession is inactive. As discussed above in connection with FIGS. 15A,15B, and 15C, a session may be inactive so that no operations areperformed in response to the protection bit being set. If it isdetermined at the test step 302″ that the session is inactive, thencontrol passes from the step 302″ to the step 304, discussed above.Otherwise, control passes from the step 302″ to continue on processingat the step 306, discussed above in connection with FIG. 11.

[0143] Referring to FIG. 16B, a portion of a flow chart 320″ shows stepsthat correspond to steps of the flow chart 320 of FIG. 12 that aremodified to account for the use of the protection bit scheme illustratedin FIGS. 15A, 15B, and 15C and described above. A pair of steps 322′,322″ replace the step 322 of the flow chart 320 of FIG. 12. The step322′ is a test step like the step 322 where it is determined if theprotection bit for the track being written to is set. If not, thencontrol passes from the step 322′ to the step 324, discussed above inconnection with FIG. 12, where a normal write is performed. Followingthe step 324, processing is complete.

[0144] If it is determined at the test step 322′ that the protection bitof the track being written to is set, control passes from the step 322′to the test step 322″ where it is determined if the correspondingsession is inactive. If it is determined at the test step 322″ that thecorresponding session is inactive, then control passes from the step322″ to the step 324, discussed above. Otherwise, control passes fromthe step 322″ to continue on processing at the step 326, discussed abovein connection with FIG. 12.

[0145] Establishing a virtual device to a standard logical device may beperformed using three separate system calls. The first, Register,reserves a session number and corresponding bit position in theprotection bits of the standard logical device and, for someembodiments, creates or obtains a corresponding virtual device. Thesecond, Relate, relates a virtual device with the standard logicaldevice by modifying the pointers for the virtual device, as describedabove, and also sets the protection bits of the standard logical device.The third, Activate, causes the virtual device to represent a point intime copy at the time that Activate is invoked and, in some cases, makesthe virtual device ready to a host. In the case of using three systemcalls, the steps 214, 216, 217, 218 of FIG. 8, discussed above, may notbe performed or may be performed differently, as set forth in thediscussion below.

[0146] In addition, as described in more detail below, it may bepossible perform the Register and Relate steps for multiple pairs ofvirtual devices and standard logical devices and then perform a singleActivate step that causes all of the virtual devices to be establishedto their corresponding standard logical devices. Note also that, forpurposes of the description herein, standard logical device may refer toany logical storage device generally having its own storage tracks (evenif some of the tracks could be indirect at times) while virtual storagedevice may refer to a storage device that, by definition, uses storagetracks of other devices.

[0147] Referring to FIG. 17, a flow chart 430 illustrates stepsperformed in connection with registering a standard logical device.Registering may be performed using a system call (syscall) that ispassed identifiers for the standard logical device and, for someembodiments, a corresponding virtual device. In some embodiments, theRegister syscall may be passed only the standard logical device and mayreturn an identifier for a virtual device created by the Registersyscall. In other embodiments, the Register syscall does not handle anyvirtual devices and is simply passed a standard logical device.

[0148] Processing begins at a first step 432 where a session number isreserved in a manner similar to that discussed above in connection withthe step 404 of FIG. 15A. Following step 432 is a step 433 whereexclusive access to appropriate resources (e.g., of the standard logicaldevice) is enabled in a manner similar to that discussed above inconnection with FIGS. 15B and 15C. Following the step 433 is a step 434where the corresponding session is established to an inactive state in amanner similar to that discussed above in connection with the step 414of FIG. 15B. Following the step 434 is a step 436 where exclusive accessto appropriate resources is disabled in a manner similar to thatdiscussed above. Note that establishing the session to an inactive statedoes not alter write processing to the standard logical device. Notealso that, just as with FIGS. 15B and 15C, for some embodiments it maynot be necessary to enable and disable exclusive access to the resourcesused in connection with the step 434. This is illustrated by alternativepaths 437 a, 437 b.

[0149] Following the step 436 is a test step 438 which determines if theoperations performed at the previous steps 432-434, 436 were successful.The operations may not have been successful for a variety of reasonsincluding, for example, the fact that all of the protection bits for thestandard logical device have already been used for other purposes. In anembodiment illustrated herein, there are sixteen protection bits. Thus,if prior to executing step 432, all sixteen protection bits for thestandard logical device are being used, then the result at the test step438 will indicate that the previous operations were not successful. Ifit is determined at the test step 438 that the previous operations werenot successful, control passes from the step 438 to a step 442 where anerror is returned. Following step 442, processing is complete.

[0150] If it is determined at the test step 438 that the previousoperations were successful, then control passes from the step 438 to astep 444 where the virtual device is created. In some embodiments, thevirtual device is created at the step 444 and passed back to the callerof the Register routine. In other embodiments, the virtual device mayexist prior to invoking the Register routine, in which case there is noneed to create a new virtual device at the step 444. In still otherembodiments (discussed below), the Register routine does not handle(i.e., create or get passed) any virtual devices. Rather, the virtualdevice may be created or obtained in a separate step either before orafter the Register routine, such as in connection with a Relate routine(described below), or as part of a general system configuration.

[0151] Following step 444 is a step 446 where information regarding thestandard logical device (and perhaps a virtual device, if one is createdand/or used in connection with the Register routine) is placed in theheader of the device table for the standard logical device. Providingthe information in the header of the device table of the standardlogical device facilitates processing later on once the standard logicaldevice and a corresponding virtual device is activated (describedbelow). In some embodiments, it may be useful to enable exclusive accessto appropriate resources of the standard logical device prior to placingthe information in the header. Following the step 446, processing iscomplete.

[0152] Note that the processing illustrated in the flow chart 430 doesnot cause any virtual device to be a point in time copy of the standardlogical device and does not make any virtual device accessible. TheRegister routine illustrated by the flow chart 430 corresponds topreliminary operations that facilitate later activation of a standardlogical device/virtual device pair. Note also an alternative path 448from the step 438 to the step 446 illustrates embodiments where theRegister routine does not cause any virtual device to be created. Thus,if the Register routine does not handle virtual devices, then controlpasses from the test step 438 directly to the step 446 via the path 448if the Register operation was successful.

[0153] Referring to FIG. 18, a flow chart 450 illustrates stepsperformed in connection with relating a virtual device to a standardlogical device. Just with the Register routine, the Relate routine ispart of the preliminary processing that is performed prior to activationand use of a standard logical device/virtual device pair. Relating maybe performed by making a system call in which the parameters are thestandard logical device and, for some embodiments, a correspondingvirtual device (passed, for example, by a host). In other embodiments,the Relate routine may cause a virtual device to be created (e.g., bycalling a separate create routine) or may simply obtain a preexistingunused virtual device that is provided in connection with systemconfiguration or provided by some other means. In those embodiments, theRelate routine may be passed a pointer to storage that the Relateroutine uses to place an identifier for the newly created/obtainedvirtual device.

[0154] Processing begins at a first test step 452 where it is determinedif the standard logical device being related has been previouslyregistered. Note that the Relate routine may not be called for astandard logical device unless the standard logical device has beenpreviously registered. If the standard logical device has not beenregistered, then control passes from the step 452 to a step 454 whereinan error is returned. Following the step 454, processing is complete.Note that the step 454 (and other error steps described herein) mayactually refer to separate error processing that does somethingdifferent than report errors. For example, the processing performed atthe step 454 may include measure taken to correct an error and continueprocessing.

[0155] If it is determined that the test step 452 that the standardlogical device has been registered, then control passes from the step452 to a step 455 where a virtual device is obtained for pairing withthe standard logical device. In some embodiments, the virtual device iscreated or obtained in connection with the Register routine (or at leastbefore the Relate routine is called), in which case the step 455 mayrepresent the Relate routine being passed the virtual device previouslycreated (by, for example, a host) or obtained and an identifier for thevirtual device is passed back to the calling routine. In otherembodiments, the virtual device is created or obtained by the Relateroutine at the step 455. Following the step 455 is a step 456 whereexclusive access to appropriate resources (e.g., the standard logicaldevice) is enabled in a manner similar to that discussed above inconnection with FIGS. 15B and 15C. Following the step 456 is a step 458where all the pointers in the device table for the virtual device aremade to point to corresponding tracks of the standard logical device.The processing performed at the step 458 is analogous to the pointermodifications provided at the step 216 of the flow chart 210 of FIG. 8,discussed above. Following the step 458 is a step 461 where informationabout the standard logical device/virtual device pair is placed in theheaders of both the standard logical device and the virtual device. Thisinformation is used in connection with subsequent accesses for thedevices, as described elsewhere herein. Following the step 461 is a step462 where exclusive access to appropriate resources is disabled in amanner similar to that discussed above. In some embodiments, exclusiveaccess may be enabled prior to placing the information in the header andmay be disabled after the information is placed therein. Note that, justas with FIGS. 15B and 15C, for some embodiments it may not be necessaryto enable and disable exclusive access to the resources used inconnection with the step 458 and/or the step 461. This is illustrated byalternative paths 463 a, 463 b.

[0156] Following the step 462 is a step 464 where the protection bitsfor the standard logical device are set, thus indicating specialprocessing to be performed when a write is provided to a track of thestandard logical device. Note, however, that when the protection bitsare set at the step 464, no special processing will take place uponwrites to the tracks of the standard logical device because, asdiscussed above, the session is initially inactive. Thus, even though aprotection bit may have been set for a track at the step 464, writes tothe standard logical device will cause no special processing is to beperformed because the session is inactive. This is illustrated above inconnection with the steps 302″ and 322″ of FIG. 16A and FIG. 16B.

[0157] Following the step 464 is a step 466 where the standard logicaldevice/virtual device pair is added to a list. As discussed in moredetail below, it is possible to activate a plurality of standard logicaldevice/virtual device pairs with one call. The list used at the step 466contains a list related pairs that have not yet been activated. Asdiscussed in more detail below, the list is used by the Activationroutine. Alternatively, the Relate routine may return the standardlogical device/virtual device pair (or just the virtual device or justthe standard logical device) to the calling routine (e.g., a hostapplication) that maintains the list. Alternatively still, the Relateroutine may be passed a list identifier, which is used by the Relateroutine to determine a particular list to which the standard logicaldevice/virtual device pair is to be added. In that case, it may beuseful to have a separate routine that creates the list identifiersand/or list structures/storage and which maintains the lists. Ininstances where the list and/or list id is a passed parameter, it may bepossible for the calling routine to maintain more than one list. TheRelate routine may create the list after being passed a plurality ofstandard logical devices and, optionally, a corresponding plurality ofvirtual devices. In that case, the Relate routine may pass back the listthat is created.

[0158] Referring to FIG. 19A, a flow chart 480 illustrates stepsperformed in connection with the Activate routine that activates one ormore standard logical device/virtual device pairs. Prior to activation,an unused virtual device is not ready to any host. However, in thecourse of activation, a virtual device is made ready to one or morehosts.

[0159] Processing begins at a first step 482 where a pointer is set topoint to the first item on a list like the list described above inconnection with the step 466 of the flow chart 450. The pointer is usedto point to various elements on the list. The list may be passed as aparameter to the Activate routine. Alternatively, a list id may bepassed where the list id is used by the Activate routine to distinguishbetween lists to which the Activate routine has access. Alternativelystill, the Relate and Activate routines may use a single global list sothat any call to the Activate routine causes all previously-relatedstandard logical device/virtual device pairs to be activated. Of course,instead of a formal list structure, it may be possible to pass each ofthe standard logical device/virtual device pairs as parameters to theActivate routine.

[0160] Following the step 482 is a test step 484 where it is determinedif processing is complete (i.e. if the end of the list has beenreached). This may be determined by examining the pointer used toiterate through the list. If processing of the list is not complete,then control passes from the step 484 to a step 485, which determines ifthe Relate operation was previously performed on the standard logicaldevice/virtual device pair indicated by the pointer. If the Relateoperation was not previously performed (and thus no activation ispossible), then control transfers from the step 485 to a step 486 wherean error is returned. Following the step 486, processing is complete.

[0161] If it is determined at the step 485 that the Relate routine wasperformed on the standard logical device/virtual device pair beingactivated, then control transfers from the step 485 to a step 487 whereexclusive access to appropriate resources (e.g., the standard logicaldevice) is enabled in a manner similar to that discussed above inconnection with FIGS. 15B and 15C. Following the step 487 is a step 488where the pointer is made to point to the next standard logicaldevice/virtual device pair on the list. Following the step 488, controltransfers back to the test step 484 to determine if processing of thelist is complete.

[0162] If it is determined at the test step 484 that processing of thelist is complete (and thus all standard logical devices corresponding tovirtual devices to be activated have been determined to have beenpreviously related), control passes from the step 484 to a step 492where the pointer that keeps track of elements on the list is made topoint to the first item in the list of standard logical device/virtualdevice pairs. Following the step 492 is a test step 494 where it isdetermined if the entire list has been processed. If not, then controltransfers from the step 494 to a step 496 to activate the sessioncorresponding to the protection bit that has been set for the standardlogical device/virtual device pair. Activating the session at the step496 is analogous to the processing performed at the step 424 in the flowchart 420, of FIG. 15C, discussed above. Activating the session at thestep 496 causes the special virtual device processing, discussedelsewhere herein, to be performed when a write occurs to a track of thestandard logical device having a set protection bit. In addition,activating a session makes the virtual device ready to a host. Followingthe step 496 is a step 498 where the pointer that is keeping track ofthe processed items on the list is made to point to the next item.Following the step 498, control transfers back to the test step 494.

[0163] If it is determined at the test step 494 that the entire list ofstandard logical device/virtual device pairs has been processed (so thatall standard logical devices corresponding to virtual devices beingactivated have had the corresponding sessions made active), controltransfers from the step 494 to a step 502 where the pointer is made topoint to the first standard logical device/virtual device pair in thelist. Following the step 502 is a step 504 where it is determined if theentire list has been processed. If is determined that the entire listhas been processed, control transfers from the step 504 to a step 506where exclusive access to appropriate resources (obtained at the step487) is disabled in a manner similar to that discussed above. Followingthe step 506 is a step 508 where the pointer is made to point to thenext item on the list. Following the step 508, control transfers back tothe test step 504 to determine if the end of the list has been reached.

[0164] If it is determined at the test step 504 that the end of the listhas been reached, control transfers from the step 504 to a step 512where the list is cleared so that a subsequent call to the Activateroutine will not attempt to reactivate already activated standardlogical device/virtual device pairs. Following the step 512, processingis complete. Note that, just as with FIGS. 15B and 15C, for someembodiments it may not be necessary to enable and disable exclusiveaccess to the resources used in connection with the steps 487, 506. Thisis illustrated by alternative paths 513 a, 513 b.

[0165] Note that, in some instances, exclusive access for some standardlogical devices of a list may have been enabled at the step 487 prior toone of the devices on the list causing an error at the step 485. Inthose cases, prior to execution of the step 486, the standard logicaldevices to which exclusive access has already been enabled haveexclusive access thereto disabled in a manner similar to thatillustrated above in connection with the steps 502, 504, 506, 508.

[0166] In some embodiments, it may be possible to not use a list at thestep 466 of FIG. 18 for keeping track of the standard logicaldevice/virtual device pairs. Instead, the Activate routine could becalled by passing the various standard logical device/virtual devicepairs directly thereto. In that case, the list used in the processingillustrated by the flow chart 480 of FIG. 19A would be the list ofparameters passed to the Activate routine.

[0167] In other embodiments, it may be possible to provide additionalcalls such as Begin Group and Process Group where a Begin Group call isprovided prior to a plurality of Relate calls (or Register and Relatecalls). Then, when it is time to activate the various standard logicaldevice/virtual device pairs that were registered and related after theBegin Group call, the call to Process Group is made. The Process Groupcall, in effect, activates all of the standard logical device/virtualdevice pairs that were registered and related after the Begin Groupcall. Such embodiments may use the list, discussed above in connectionwith FIGS. 18 and 19A, where a Begin Group call causes creation of anew, empty, list and a Process Group call causes the processing shown inthe flow chart 480 of FIG. 19A to be performed. In such a system, aRelate call that is not bracketed by a Begin Group/Process Group pair(i.e. a Relate that is not called after a Begin Group call) could causethe Activate to be executed immediately after the relate is successfullycompleted. That is, any Register call and Relate call for a standardlogical device/virtual device pair that is not after a Begin Group callmay cause automatic activation of the standard logical device/virtualdevice pair. In other embodiments, the Activate call would not beautomatic. Note also that, in some embodiments, it may be possible touse multiple lists to separately activate different sets of standardlogical device/virtual device pairs. In those cases, the specific listmay be a parameter passed to a Process Group call, which could then bepassed on, in some fashion, to the Activate routine.

[0168] In some embodiments, any one of the Register, Relate and/orActivate calls may include optional parameters for modifying the devicename (or other device identifiers) for the virtual device. This may beuseful in operating systems where it is impermissible to have twodevices that have exactly the same name and/or device identifiers. If avirtual device is a copy of a standard logical device, it may benecessary to change the name of the virtual device. In addition, in someembodiments, it may be possible to have an optional parameter indicatingwhether the virtual device will be on line or off line upon activation.In some operating systems, an on-line device is accessible to a host(ready to the host) while an off-line device (not ready to a host) isnot. Thus, for host applications that wish to create a virtual devicebut do not wish to permit access thereto, it may be possible to pass aparameter to any one of the Register, Relate and/or Activate calls toindicate that the virtual device is to be on line or off line uponactivation.

[0169] Referring to FIG. 19B, a flow chart 480′ illustrates stepsperformed in connection with an alternative embodiment for the Activateroutine that activates one or more standard logical device/virtualdevice pairs. Processing begins at a first step 482′ where a pointer isset to point to the first item on a list like the list described abovein connection with the step 466 of the flow chart 450. The pointer isused to point to various elements on the list. The list may be passed asa parameter to the Activate routine. Alternatively, a list id may bepassed where the list id is used by the Activate routine to distinguishbetween lists to which the Activate routine has access. Alternativelystill, the Relate and Activate routines may use a single global list sothat any call to the Activate routine causes all previously-relatedstandard logical device/virtual device pairs to be activated. Of course,instead of a formal list structure, it may be possible to pass each ofthe standard logical device/virtual device pairs (or only one pair) asparameters to the Activate routine.

[0170] Following the step 482′ is a test step 484′ where it isdetermined if processing is complete (i.e. if the end of the list hasbeen reached). This may be determined by examining the pointer used toiterate through the list. If processing of the list is not complete,then control passes from the step 484′ to a step 485′, which determinesif the Relate operation was previously performed on the standard logicaldevice/virtual device pair indicated by the pointer. If the Relateoperation was not previously performed (and thus no activation ispossible), then control transfers from the step 485′ to a step 486′where an error is returned. Following the step 486′, processing iscomplete.

[0171] If it is determined at the step 485′ that the Relate routine wasperformed on the standard logical device/virtual device pair beingactivated, then control transfers from the step 485′ to a step 488′where the pointer is made to point to the next standard logicaldevice/virtual device pair on the list. Following the step 488′, controltransfers back to the test step 484′ to determine if processing of thelist is complete.

[0172] If it is determined at the test step 484′ that processing of thelist is complete (and thus all standard logical devices corresponding tovirtual devices to be activated have been reviewed), control passes fromthe step 484′ to a step 492′ where the pointer that keeps track ofelements on the list is made to point to the first item in the list ofstandard logical device/virtual device pairs. Following the step 492′ isa test step 494′ where it is determined if the entire list has beenprocessed. If not, then control transfers from the step 494′ to a step495′ where exclusive access to appropriate resources (e.g., the standardlogical device) is enabled in a manner similar to that discussed abovein connection with FIGS. 15B and 15C. Following the step 495′ is a step496′ which activates the session corresponding to the protection bitthat has been set for the standard logical device/virtual device pair.Activation the session at the step 496′ is analogous to the processingperformed at the step 424 in the flow chart 420, of FIG. 15C, discussedabove. Activating the session at the step 496′ causes the specialvirtual device processing, discussed elsewhere herein, to be performedwhen a write occurs to a track of the standard logical device having aset protection bit. Following the step 496′ is a step 497′ whereexclusive access to appropriate resources is disabled in a mannersimilar to that discussed above. Following the step 497′ is a step 498′where the pointer that is keeping track of the processed items on thelist is made to point to the next item. Following the step 498′, controltransfers back to the test step 494′.

[0173] If it is determined at the test step 494′ that the entire list ofstandard logical device/virtual device pairs has been processed (so thatall standard logical devices corresponding to virtual devices beingactivated have had the corresponding sessions made active), controltransfers from the step 494′ to a step 512′ where the list is cleared sothat a subsequent call to the Activate routine will not attempt toreactivate already activated standard logical device/virtual devicepairs. Following the step 512′, processing is complete. Note that, justas with FIGS. 15B and 15C, for some embodiments it may not be necessaryto enable and disable exclusive access to the resources used inconnection with the step 496′. This is illustrated by alternative paths513 a′, 513 b′.

[0174] The alternative embodiment illustrated by the flow chart 480′ ofFIG. 19B may be used in instances where it is not essential that allstandard logical device/virtual device pairs be activated synchronouslyand/or in instances where a host application performs processing tosynchronize activations when necessary. Different options for hostapplication processing that may be used with FIG. 19B (or FIG. 19A) isdiscussed elsewhere herein.

[0175] In some instances, it may be desirable to restore a virtualdevice back to the corresponding standard logical device or to anotherstandard logical device. That is, it may be useful to convert thevirtual device to an actual logical device with its own data storage ortransfer a virtual device to another virtual device.

[0176] Referring to FIG. 20A, a standard logical device 532 is shown ascorresponding to a virtual device 534 and a log device 536 where it isdesirable to restore the virtual device 534 to a logical device havingits own storage. Note that, in the example of FIG. 20A, some tracks ofthe standard logical device 532 that are pointed to by the virtualdevice 534 have not changed since the virtual device 534 wasestablished. Other tracks of the log device 536 that are pointed to bythe virtual device 534 correspond to tracks of the standard logicaldevice 532 that have changed since the virtual device 534 wasestablished.

[0177] Referring to FIG. 20B, the results of restoring the virtualdevice 534 to the standard logical device 532 of FIG. 20A (the old stddev) are shown. The virtual device 534 has been eliminated. In addition,for any tracks of the standard logical device 532 that are pointed to bythe virtual device 534, no special processing has been performed.However, for tracks of the log device 536 that are pointed to by thevirtual device 534, the corresponding tracks of the standard logicaldevice 532 are modified to point to the corresponding tracks of the logdevice 536. Thus, a host accessing the standard logical device 532 will,in effect, access the data on the track of the log device 536. Thisindirection mechanism provides a way to restore the standard logicaldevice 532 without having to immediately move all of the data from thelog device 536 to the standard logical device 532. In an embodimentherein, the appropriate tracks of a standard logical device 532 are madeto point to corresponding tracks of a log device 536 and, in addition, abackground copy process copies to the standard logical device 532 anytracks that are pointed to by the standard logical device 532. In anembodiment herein, the background copy process is designed to notappreciably interfere with normal access of the standard logical device532. In addition, in the case of accessing a track of the standardlogical device 532 that points to a track of the log device 536, a copyis also performed when the track is accessed rather than waiting for thebackground task to copy the track. Note that when a virtual device isrestored to the standard logical device to which the virtual device wasestablished, there are no other virtual devices established to thestandard logical device. However, for other types of restore, discussedbelow, there may be more than one virtual device established to astandard logical device prior to restoring the virtual device to anotherstandard logical device or to another virtual device.

[0178] Referring to FIG. 20C, another type of restore is illustratedwhere the data represented by the virtual device 534 of FIG. 20A iscopied to a new standard logical device 538. In that case, the newstandard logical device 538 consists entirely of indirect tracks thatpoint to either the standard logical device 532 in instances where thevirtual device 534 previously pointed to the standard logical device 532or, alternatively, point to the log device 536 in instances where thevirtual device 534 previously pointed to the log device 536. As in theembodiment illustrated in FIG. 20B, a background copy task may be usedto copy data from the standard logical device 532 and the log device 536to the tracks of the standard logical device 538 so that, eventually,the standard logical device 538 will not contain any indirect tracksfrom the restore operation. Also, as in the embodiment of FIG. 20B,access to a particular track of the standard logical device 538 maycause that track to be copied in connection with the access rather thanwaiting for the background copy to move the track..

[0179] Referring to FIG. 20D, a mirror logical device 532′ is a logicalvolume that represents a point in time copy of the standard logicaldevice 532. Like the standard logical device 532, the mirror logicaldevice 532′ contains its own storage for tracks of data. In anembodiment herein, the mirror logical device 532′ is first establishedto the standard logical device 532, which initially causes data to becopied from the standard logical device 532 to the mirror logical device532′. Once the initial copying is complete, the logical devices 532,532′ are “synced”. Write operations performed to the standard logicaldevice 532 are also performed to corresponding tracks of the mirrorlogical device 532′. Any read operations for a track not in cache may beperformed to either of the devices 532, 532′.

[0180] After the mirror logical device 532′ has been established to thestandard logical device 532, it is possible to “split” the devices 532,532′ so that operations performed on one of the devices 532, 532′ (e.g.,writes) are not automatically performed on the other one of the devices532, 532′. However, even after splitting the devices 532, 532′, theremay be a mechanism that keeps track of the changes that occur after thesplit so that, for example, it is possible to resync the devices 532,532′ after a split without having to copy all of the data from thestandard logical device 532 to the mirror logical device 532′.

[0181] In the embodiment illustrated by FIG. 20D, the mirror logicaldevice 532′ was split from the standard logical device 532 after thevirtual device 534 was established to the standard logical device 532.In this case, restoring the virtual device 534 to the mirror logicaldevice 532′ is like restoring the virtual device to the standard logicaldevice 532 as shown in FIG. 20B, where tracks of the mirror logicaldevice 532′ that have changed after the virtual device 534 wasestablished are made to be indirect pointers to tracks of the log device536 and tracks that did not change after the virtual device 534 wasestablished may be accessed directly on the mirror logical device 532′.This is explained in more detail below. Note that the embodiment of FIG.20D exhibits the advantages of the embodiment of FIG. 20B (lessindirection and less background copying) and the advantages of theembodiment of FIG. 20C (standard logical device 532 is not modified toperform the restore).

[0182] Referring to FIG. 20E, the virtual device 534 is restored to anew virtual device 534′. In this case, the new virtual device 534′ isessentially a copy of the original virtual device 534, with pointers tothe standard logical device 532 and the log device 536.

[0183] In some embodiments, it may be possible to provide an optionalparameter for restoring that allows changing the name of the device towhich the virtual device is being restored in connection with therestoration. Similarly, an optional parameter may be used so that thedevice to which the virtual device is being restored may be made on lineor off line. In addition, it may be possible to restore multiple devicessynchronously using Begin Group and Process Group commands similar tothose discussed above in connection with establishing virtual devices.

[0184] Referring to FIG. 21, a flow chart 550 illustrates stepsperformed in connection with performing a restore like that illustratedin FIG. 20B and discussed above where a virtual device is restored to astandard logical device to which the virtual device was previouslyestablished. Processing begins at a first step 552 where the first trackof the virtual device is pointed to. A pointer is used to iteratethrough and process each track of the virtual device. Following step 552is a test step 554, which determines if there are more tracks to beprocessed. If not, then control transfers from the step 554 to a step555 where a value indicating that a restore has been performed for thestandard logical device is written to a portion of the header field ofthe device table corresponding to the session that had been used for thevirtual device. Following the step 555 is a step 557 where the virtualdevice is deallocated in a manner similar to that described above inconnection with FIG. 14, except, of course, that the log tracks are notreturned to the free list.

[0185] Following step 557, is a step 558 where the session type ischanged. In an embodiment herein, the session type is changed at thestep 558 to indicate that the standard logical device has tracks thereonthat indirectly point to tracks of the log device (explained in moredetail below). For this session type, tracks are gradually migrated fromthe log device to the standard logical device. This migration may beperformed by a system-wide task that resolves indirect tracks for thesession type set at the step 558. Alternatively, it is also possible toexplicitly start a background copy task (like a background copy thatmight be used in a snap operation). The background copy task resolvesindirect pointers by copying data from tracks of the log device to thestandard logical device. Note that, as tracks are moved from thestandard logical device to the log device, tracks of the log device thatare not pointed to by other virtual devices are returned to the freelist in a manner similar to that discussed above in connection with thesteps 386, 388 of FIG. 14. Note also that if a write occurs to anindirect track of the standard logical device that points to a track ofthe log device, the track containing the data is first copied from thelog device to the standard logical device (and possibly returned to thefree list of log device tracks) prior to the write being executed. Inother embodiments, writes to an indirect track where the data is on thelog device may cause the write to be executed directly to the log devicetrack. Following the step 558, processing is complete.

[0186] If it is determined that the test step 554 that there are moretracks to be processed, then control passes from the step 554 to a teststep 562 where it is determined that if the virtual device track beingprocessed points to the standard logical device. If not (meaning thatthe track of the virtual device points to the log device), then controltransfers from the step 562 to a step 564 where the track of thestandard logical device is made to point to the corresponding track ofthe log device. In that way, a subsequent access to the track of thestandard logical device will fetch the data stored on the track of thelog device. However, as discussed above, the tracks will be migratedfrom the log device to the standard logical device so that, eventually,the standard logical device will contain the data that is initiallyprovided on the log device. Note that accessing and modifying tracks ofa storage device as discussed herein may require inhibiting access byother processes by, for example, locking the tracks prior to determiningthe state thereof and/or prior to modifying the tracks. Steps forinhibiting access by other processes are not explicitly shown herein,but it is understood that such steps will be performed when needed.

[0187] Following the step 564 is a step 567 where it is determined ifthe protection bit for the track is set. Since the track of the virtualdevice points to the log device, it is expected that the protection bitwould be clear at this step, in accordance with other processingdiscussed herein. Thus, if it is determined at the step 567 that theprotection bit for the track is set, control passes from the step 567 toa step 568, where error processing is performed. The error processingmay include simply logging the error, suspending processing andreturning an error indicator, taking steps to correct the error, etc.

[0188] If it is determined at the step 567 that the protection bit forthe track is not set, or following the step 568, control transfers to astep 572 where the next track of the virtual device is pointed to inorder to perform the processing described herein. Following the step572, control transfers back to the test step 554, discussed above.

[0189] If it is determined at the test step 562 that the virtual devicetrack being processed points to the standard logical device, controltransfers from the step 562 to a step 574, where it is determined if theprotection bit for the track is set. In accordance with other processingdiscussed herein, it is expected that the protection bit would be set ifthe virtual device track (table) points to the standard logical device.Thus, if it is determined at the step 574 that the protection bit is notset, control transfers from the step 574 to the step 568, discussedabove.

[0190] If it is determined at the step 574 that the protection bit isset (as expected), control transfers from the step 574 to a step 578,where the protection bit is cleared so that no special processing willbe performed on behalf of the previous standard logical device/virtualdevice session in connection a write to the track of the standardlogical device. Note however that, as discussed below, other types ofrestore operations may require special processing in connection withwrites to tracks of the standard logical device. Following the step 578,control transfers to the step 572 to process the next track.

[0191] Referring to FIG. 22, a flow chart 580 illustrates stepsperformed in connection with restoring a virtual device to a newstandard logical device as illustrated in FIG. 20C and discussed above.Processing begins at a first step 582 where a first track of the virtualdevice is pointed to. Following step 582 is a test step 583 where it isdetermined if there are more tracks of the virtual device to beprocessed. If not, then control transfers from the step 583 to a step584 where a value that indicates that a restore has been performed forthe virtual device is written to a portion of the header field of thedevice table of the standard logical device corresponding to the sessionthat had been used for the virtual device in a manner similar to thatdiscussed above in connection with the step 555. Note, however, that inthe case of the flow chart 580, there is no corresponding step forclearing all of the protection bits. This is because, as discussed inmore detail below, the protection bits are used after the restore inthis embodiment.

[0192] Following the step 584 is a step 585 where the virtual device isdeallocated in a manner similar to that described above in connectionwith FIG. 21. Following the step 585 is a step 586 where the sessiontype is changed to facilitate migrating tracks in a manner similar tothat discussed above in connection with the step 558. Note in this case,however, that all of the tracks of the new standard logical device areindirect, so that tracks will be migrated from both the log device andthe standard logical device that was previously associated with thevirtual device that is being restored. However, just as with theembodiment of FIG. 21, free tracks of the log device will be returned tothe free list and writes to indirect tracks may cause the track to becopied to resolve the indirection. In other embodiments, writes to anindirect track on the log device may cause the write to be executeddirectly to the log device track. Following step 586, processing iscomplete.

[0193] If it is determined at the test step 583 that there are moretracks to be processed, then control transfers from the step 583 to atest step 588, where it is determined if the track (table) of thevirtual device points to the standard logical device. If so, thencontrol transfers to a test step 589, where it is determined if theprotection bit is set for the track. In accordance with the otherprocessing discussed herein, it is expected that the protection bitwould be set of the virtual device points to the standard logicaldevice. Accordingly, if it determined at the step 589 that theprotection bit is not set, then control transfers from the step 589 to astep 591 where an error processing is provided in a manner similar tothat discussed above in connection with the step 568. In someembodiments, the processing at the step 591 includes setting theprotection bit to the correct value. If it is determined at the step 589that the protection bit for the standard logical device is set, orfollowing the step 591, control transfers to a step 592, where the trackof the new standard logical device is set to be an indirect pointer tothe track of the old standard logical device (i.e., the standard logicaldevice previously established to the virtual device being restored).

[0194] If it is determined at the test step 588, that the track (table)of the virtual device does not point to the standard logical device,control transfers to a test step 593, where it is determined if theprotection bit is set for the track. In accordance with the otherprocessing discussed herein, it is expected that the protection bitwould not be set if the virtual device does not point to the standardlogical device (i.e., points to the log device). Accordingly, if itdetermined at the step 593 that the protection bit is set, then controltransfers from the step 593 to the step 591, discussed above. If it isdetermined at the step 593 that the protection bit for the standardlogical device is not set, or following the step 591, control transfersto a step 595, where the track of the new standard logical device is setto be an indirect pointer to the corresponding track of the log device.

[0195] Following the step 592 or the step 595 is a step 598 to processthe next track of the virtual device. Following the step 598, controltransfer back to the step 583, discussed above.

[0196] As mentioned above, the protection bits corresponding to therestored virtual device session are not cleared in the embodimentillustrated by FIG. 22. This may be explained with reference to FIGS.20A and 20C. First, note that some of the tracks of the standard logicaldevice 532 may never have been written to after the virtual device 534was established, and thus those tracks remain in their original state onthe standard logical device 532. When the virtual device 534 is firstrestored to the new standard logical device 538 as shown in FIG. 20C,those tracks of the standard logical device 532 are indirectly pointedto by corresponding tracks of the standard logical device 538. If asubsequent write to one of those tracks on the standard logical device532 were to occur prior to the track being copied to the standardlogical device 538, then the standard logical device 538, with anindirect reference to the newly written track on the standard logicaldevice 532, would no longer correspond to a restored version of thevirtual device 534. However, the set protection bit for the trackprevents this. After a restore such as that illustrated in FIG. 20C isperformed, a write to a track of the standard logical device 532 havinga set protection bit causes the track to first be copied to the standardlogical device 538 before the write occurs. Note that, the protectionbit for each track may be cleared after each track is copied from thestandard logical device 532 to the standard logical device 538,irrespective of whether the copy occurred in connection with the specialprocess caused by the set protection bit or by track migration initiatedat the step 588. Thus, once all of the data has been migrated from thestandard logical device 532 to the standard logical device 538, all ofthe protection bits associated with the session are expected to beclear.

[0197] Referring to FIG. 23, a partial flow chart 600 illustrates stepsperformed to restore a virtual device to a mirror logical device, asillustrated above in connection with FIG. 20D. The flow chart 600illustrates steps performed that are different from those of the flowchart 550 of FIG. 21. Portions of the flow chart 600 which interface andflow into the flow chart 550 (i.e., where the same operations areperformed) are shown in FIG. 23 and described herein.

[0198] Processing begins at a first step 602 where all changes (e.g.,writes) performed on the mirror logical device since the split operationoccurred are undone, rendering the mirror logical device substantiallyidentical to the standard logical device at a point in time just priorto the split. For embodiments disclosed herein, a split may occur afterthe virtual device is established to the standard logical device butbefore the virtual device is restored. The ability to undo the changessince the split may be provided by the mirror facility that uses featuretracking to log and track the changes that occurred since the split.

[0199] Following the step 602 is a step 604, which is like the step 552of FIG. 21 where a pointer is set to point to the first track of thevirtual device. Following the step 604 is a test step 606, which is likethe test step 554 of FIG. 21, where it is determined if there are moretracks to be processed. If not, then control transfers to the step 555of FIG. 21, discussed above. Otherwise, control transfers to a test step608, which is like the step 562 of FIG. 21, where it is determined ifthe pointer of the virtual device points to the standard logical device.If so, then control transfers to the step 574 of FIG. 21, discussedabove.

[0200] If it is determined at the step 608 that the track of the virtualdevice being processed does not point to the standard logical device(indicating at least one write was performed after the virtual devicewas established), then control transfers from the step 608 to a step612, where it is determined if all of the write operations to the trackbeing processed occurred after the mirror logical device was split fromthe standard logical device. Note that if this is the case, the undooperation at the step 602 will have restored the track of the mirrorlogical device to the same state as the corresponding track of thestandard logical device prior to the virtual device being established.

[0201] If it is determined that all writes to the track did not occurafter the split, then control transfers from the step 608 to the step564 of FIG. 21, discussed above, to cause the corresponding track of themirror logical device to indirectly point to the appropriate track ofthe log device in a manner similar to that discussed above in connectionwith FIG. 21. If it is determined at the test step 612 that all writesoccurred after the split, then control transfers from the step 612 to atest step 614, where it is determined if the virtual device is the lastvirtual device (i.e., the only virtual device) pointing to thecorresponding track of the log device. If so, then control transfersfrom the step 614 to a step 616 where the track of the log device isreturned to the free list of the log device tracks. The steps 614, 616are analogous to the steps 386, 388 of FIG. 14, discussed above.Following the step 616, or following the step 614 if the track of thelog device is being used by more than one virtual device, is the step567 of FIG. 21, which tests if the protection bit is in the proper stateand then clears the protection bit. In this instance, however, theprotection bit on both the standard logical device 532 and the mirrorlogical device 532′ are cleared. Note that transferring to the step 567causes the track of the mirror logical device to be a direct track foraccessing data.

[0202] It is useful for host applications that access the storage deviceto be able to use some of the functionality described herein. Forexample, a host application may want to create a virtual device torepresent a point in time copy of a standard logical device and then runa backup from the virtual device, after which, the virtual device may bedeallocated. In other instances, the virtual device may be used tomaintain a point in time copy of the data from the standard logicaldevice when software that uses the standard logical device is tested.After the testing period, the point in time copy represented by thevirtual device may be restored back in the standard logical device.

[0203] Referring to FIG. 24, a diagram 620 illustrates a plurality ofhosts 622-624 that access the storage device 626. Each of the hosts622-624 may create, establish, deallocate, and restore standard logicaldevice/virtual device pairs as described herein by making system callsto the storage device 626. In an embodiment disclosed herein,applications running on the hosts 622-624 would not directly make thesystem calls. Rather, an underlying layer of software translates higherlevel calls from the hosts 622-624 into the appropriate system callsthat are provided to the storage device 626. For example, the host 622may have an application that establishes a standard logicaldevice/virtual device pair by calling an Establish routine that willultimately cause the appropriate system calls (e.g., Register, Relate,and Activate) to be called using, for example, a library linked to theapplication running on the host 622, an operating system routine thatruns on the host 622, or some other appropriate mechanism.

[0204] The parameters passed to the Establish routine may include one ormore standard logical device/virtual device pairs as well as one or moreoptional name change parameters (discussed above) and one or moreonline/offline indicators that determine whether a newly-establishedvirtual device will be on line or off line as discussed above. In someembodiments, an Establish routine called from an application will onlyaccept one standard logical device/virtual device pair. In otherembodiments, an Establish routine will accept multiple standard logicaldevice/virtual device pairs (e.g., a list or list id as discussedabove). In embodiments that accept multiple standard logicaldevice/virtual device pairs, the underlying system calls may or may notcause the virtual devices to be established synchronously in the mannerdiscussed elsewhere herein. In some cases, it may be possible for a hostto handle synchronously establish multiple standard logicaldevice/virtual device pairs by, for example, using the mechanismdisclosed in U.S. patent application Ser. No. 10/134,420 filed on Apr.29, 2002, which is incorporated herein by reference, to establishappropriate consistency groups to cause synchronization of the activateoperation. In addition, it may be possible to synchronously establish aplurality of pairs by the host simply waiting for all pairs to beestablished before performing operations on any of the devices that arepart of the pairs. In some embodiments, the Establish routine may bepassed one or more standard logical devices and corresponding virtualdevices that are created and/or obtained by the establish routine.

[0205] Referring to FIG. 25, a flow chart 630 illustrates stepsperformed by an Establish routine that translates a higher levelapplication call for establishing one or more standard logicaldevice/virtual device pairs into appropriate system calls that can bemade to the storage device 626. The translation may be performed inlibrary code linked to the application itself, by the operating systemon one of the host devices 622-624, or by using any other appropriatemechanism that translates high level host application calls to systemcalls.

[0206] Processing begins at a first step 632 where it is determined ifmore than one standard logical device/virtual device pair is beingestablished. As discussed above, it is possible in some embodiments toestablish more then one standard logical device/virtual device pair in asingle call and, in some embodiments, in a way that causes all of thevirtual devices to be activated synchronously. If it is determined atthe test step 632 that more than one standard logical device/virtualdevice pair is being established, then control passes from the step 632to a step 634 where a Begin Group call is performed to create the listof standard logical device/virtual device pairs discussed above. Notethat it is possible to synchronously process and establish multiplestandard logical device/virtual device pairs without using Begin Groupand Process Group, as described above. In those cases, anotherappropriate mechanism, such as one or more of those discussed above(e.g., lists, list ids), may be invoked at the step 634 to causemultiple standard logical device/virtual device pairs to be establishedsimultaneously. Alternatively still, it may be possible to establishappropriate consistency groups as described in U.S. patent applicationSer. No. 10/134,420, referenced above and use the consistency groupmechanisms to activate multiple pairs synchronously.

[0207] If it is determined at the step 632 that only one standardlogical device/virtual device pair is to be established, or followingthe step 634, is step 636 where the first standard logicaldevice/virtual device pair is pointed to in order to facilitateprocessing thereof. In some embodiments, each standard logicaldevice/virtual device pair is stored in a data structure (containingpossibly other optional parameters, such as a new name and/or anonline/offline specifier). The data structures may be linked together ina linked list. Thus, the pointer set at the step 636 and used for followon processing is provided to traverse the list. In embodiments where theEstablish routine creates or otherwise provides corresponding virtualdevice(s), data location(s) may be passed to the Establish routine,which places one or more appropriate virtual device identifiers in thelocation(s).

[0208] Following step 636 is the step 638 which determines if processingof the list of passed parameters is complete (e.g., if the pointerpoints to the end of the list). Of course, on the first iteration, theresult of the test of the step 638 are expected to indicate thatprocessing is not complete. If it is determined at the test step 638that not all of the standard logical device/virtual device pairs (or, insome embodiments, just standard logical devices) have been processed,then control transfer from the step 638 to a step 642 to invoke theRegister routine, discussed above.

[0209] Following the step 642 is a test step 644 where it is determinedif an optional new name has been specified. If it is determined at thetest step 644 that an optional new name has not been provided, thencontrol transfers from the step 644 to a test step 646 which determinesif an optional online/offline boolean parameter has been provided. Asdiscussed above, the online/offline option allows the calling routine todetermine whether the virtual device that is being established will beonline (become available to the host) or offline (not available to thehost) upon being established. If it is determined at the test step 646that an online/offline parameters is not being provided, then controlpasses from the test step 646 to a step 648 where a Relate system callis provided to relate the standard logical device/virtual device pair.

[0210] If it is determined at the test step 646 that an optionalonline/offline parameter has been provided, then control transfers fromthe step 646 to a step 652 where the Relate system call is made.However, at the step 652, the online/offline parameters may also bepassed by the system call to indicate whether the virtual device shouldbe made online or offline at the time of establishment.

[0211] If it is determined at the test step 644 that a new name for thevirtual device has been provided, then control transfers from the step644 to a step 653 where it is determined if an optional online/offlineparameter has been provided. If it is determined at the test step 655that an optional online/offline parameters is not being provided, thencontrol transfers from the step 653 to a step 654 to provide a systemcall to Relate the pair along with the new name parameter, as discussedabove.

[0212] If it is determined at the test step 653 that an optionalonline/offline parameter has been provided in connection with thestandard logical device/virtual device pair, then control transfers fromthe step 653 to a step 656 where the pair is related along with the newname for the virtual device and with an indication of whether thevirtual device will be online or offline upon establishment.

[0213] Following each of the steps 648, 652, 654, 656, is a step 658where the pointer set at the step 636 is made to point to the nextstandard logical device/virtual device pair, if any. Following step 658,control transfers back to the test up 638 to determine if all of thestandard logical device/virtual device pairs have been processed.

[0214] If it is determined at the test step 638 that all the standardlogical devices/virtual device pairs have been processed, than controltransfers from the step 638 to a step 662 where an Activate system callis provided for each of the pairs (or, for different embodimentsdiscussed above, Activate may be called for all of the pairs). Followingstep 662 is a step 664 where it is determined if there is more than onestandard logical device/virtual device pair. If so, then controlledtransfers from the step 664 to a step 666 where a Process Group call ismade. Just as with the step 634 where Begin Group has been called, thestep 666 may represent another mechanism to synchronously establishmultiple standard logical device/virtual device pairs. In someembodiments, the routine performing the processing illustrated by theflow chart 630 keeps track of a list of standard logical device/virtualdevice pairs, in which case the entire list (or a list id, as discussedabove) may be passed to the Activate routine, as discussed above. Inother embodiments, a consistency group is formed, as described in U.S.Pat. No. 10/134,420, mentioned above.

[0215] Following the step 666 or following the step 664 if there is onlyone standard logical device/virtual device pair, is a step 668 where theresult of performing the processing set forth in the previous steps isreturned to the calling routine (e.g., success or failure and, in someembodiments, identifiers for the newly established virtual devices).Following the step 668, processing is complete.

[0216] It is also possible to provide a Restore routine that is calledfrom an application at one of the hosts 622-624 where the Restoreroutine takes, as parameters, one or more standard logicaldevice/virtual device pairs as well as optional names for renaming thestandard logical device(s) to which the virtual devices(s) are restoredand optional online/offline boolean values indicating whether thestandard logical device(s) will be online or offline. The parameters maybe passed in a linked list in a manner similar to that discussed abovein connection with the Establish routine. Note also that, in the case ofthe Restore routine, the standard logical device of a standard logicaldevice/virtual device pair may be the same standard logical device towhich the virtual device was established or could be a differentstandard logical device or a mirror logical device, as discussed above.Also as discussed above, a virtual device may be restored to anothervirtual device.

[0217] Referring to FIG. 26, a flow chart 680 illustrates stepsperformed in connection with a host application calling a Restoreroutine to restore a virtual device as illustrated in FIGS. 20B, 20C,20D, 20E. Processing begins at a first step 692 where it is determinedif an optional new name has been provided as a parameter to the Restoreroutine. As discussed above, in some instances it is possible to restorea virtual device to a standard logical device or to a new virtual deviceand, at the same time, provide the standard logical device or newvirtual device with a different name than that associated with the oldvirtual device. If it is determined at the test step 692 that a new namehas not been provided, then control transfers from the step 692 to atest step 694 where it is determined if an optional online/offlineparameter has been provided. As discussed above, in some instances it ispossible to restore a virtual device to a standard logical device or newvirtual device while, at the same time, making the standard logicaldevice or new virtual device not available to the host (offline).

[0218] If it is determined at the test step 694 that an optionalonline/offline parameter has not been provided, then control transfersfrom the step 694 to a step 696 where the virtual device is restored bymaking a Restore system call, as discussed above. Alternatively, if itis determined at the test step 694 that an optional online/offlineparameter has been provided, then control transfers from the test step694 to a step 698 where a Restore system call is provided with theoptional online/offline parameter.

[0219] If it is determined at the test step 692 that a new name has beenprovided to the Restore routine, then control transfers from the step692 to a test step 702 where it is determined if an optionalonline/offline parameter has also been provided. If not, then controltransfers from the test step 702 to a step 704 where a Restore systemcall is provided, along with the new name of the standard logical deviceor new virtual device, to restore the virtual device. If it isdetermined that the test step 702 that an optional online/offlineparameter has been provided, then control transfers from the test step702 to a step 706 where a Restore system call is performed with the newname and online/offline parameter. Following any of the steps 696, 698,704, 706, processing is complete.

[0220] In some instances, it may be desirable to deactivate (rather thandeallocate) a virtual device such that, while the virtual device is nolonger accessible, the tracks written to the log device in connectionwith using the virtual device are still available. That is, a call todeactivate a virtual device makes the virtual device not ready to anyhost that attempts to access it and causes writes to the correspondingstandard logical device to not result in any special processing such asthat discussed above. In effect, a deactivated virtual device representsthe tracks of the corresponding standard logical device that changedfrom the time that the virtual device was established until the timethat the virtual device was deactivated. For example, if a virtualdevice was established at noon and deactivated at 6 p.m., then thetracks of the log device pointed to by the table of the deactivatedvirtual device represent only those tracks of the standard logicaldevice that changed between noon and 6 p.m.

[0221] Referring to FIG. 27, a flow chart 730 illustrates stepsperformed in connection with deactivating a virtual device. Processingbegins at a first step 732 where exclusive access to appropriateresources (e.g., the virtual device) is enabled in a manner similar tothat discussed above in connection with FIGS. 15B and 15C. Following thestep 732 is a step 734 where exclusive access to appropriate resources(e.g., the corresponding standard logical device) is enabled in a mannersimilar to that discussed above in connection with FIGS. 15B and 15C.

[0222] Following the step 734 is a step 736 where the sessioncorresponding to the standard logical/virtual device pair is madeinactive by, for example, writing an appropriate value to the deviceheader field. Following this, any writes to the standard logical devicewill not cause any special processing to occur. This effectively freezesthe changes to the virtual device.

[0223] Following the step 736 is a step 738 where exclusive access toappropriate resources of the standard logical device is disabled in amanner similar to that discussed above. Note that since the session ismade inactive at the step 736, any subsequent writes to the standardlogical device will not effect the virtual device. Following the step738 is a step 742 where the virtual device is made not ready. Making thevirtual device not ready at the step 742 will prevent the virtual devicefrom being modified by, for example, a host. However, the tablecorresponding to the virtual device is maintained in order to provideaccess to the tracks of the log device corresponding to the virtualdevice. In other embodiments, it is possible to read the tracks of thelog device through the virtual device (i.e., read the virtual device) bymaking the virtual device not ready for writes only at the step 742 inconjunction with making the session inactive at the step 736.

[0224] Following the step 742 is a step 744 where exclusive access toappropriate resources of the standard logical device is disabled in amanner similar to that discussed above. Note, however, that theprocessing at the step 744 does not facilitate access (or at least writeaccess) by any host device to the virtual device, since the virtualdevice was made not ready at the step 742. In addition, the processingat the step 744 does not cause data from the corresponding standardlogical device to be written to the virtual device since, as describedabove, the session was made inactive at the step 736 in order to preventfurther manipulation of the virtual device on account of the standardlogical device. Following the step 744, processing is complete.

[0225] Note that, just as with FIGS. 15B and 15C, for some embodimentsit may not be necessary to enable and disable exclusive access to theresources used in connection with one or more of the steps 736, 742.This is illustrated by alternative paths 746 a-746 d.

[0226] A host application may access the tracks of the log devicecorresponding to the deactivated virtual device by making two systemcalls. The first system call reads the protection bits for the standardlogical device, and thus provides information as to which tracks of thevirtual device point to the log device, and thus correspond to tracksmodified in between the time that the virtual device is established andthe virtual device is deactivated. That is, for any protection bit ofthe standard logical device that is set, there is no corresponding trackof the deactivated virtual device that points to the log device.Conversely, if a bit for a track of the standard logical device isclear, thus indicating that a write to the track occurred after thevirtual device was established but before the virtual device wasdeactivated, then there is a corresponding track on the log devicepointed to by the deactivated virtual device. This system call wouldpass as a parameter an identifier for a track and would receive back thestate of the protection bit for the track. Alternatively, the systemcall could be passed a pointer to a data structure for storing the stateof a range of tracks (including all the tracks) that are filled in andreturned to the calling routine.

[0227] Another system call would allow reading of saved trackscorresponding to a deactivated virtual device. The routine for readingof save tracks of a deactivated virtual device would take, asparameters, an identifier for the virtual device and a track identifierindicating which track is to be read. Note that one possible mechanismfor reading log tracks corresponding to a deactivated virtual device isto have the virtual device be not ready for writing only and todeactivate the session corresponding to the virtual device. In such acase, the log tracks may be accessed through the virtual device byreading the virtual device.

[0228] Referring to FIG. 28, a flow chart 750 illustrates stepsperformed in an embodiment that reads a track of a deactivated virtualdevice. Processing begins at a first step 752 where it is determined ifthe virtual device passed as a parameter to the routine for readingtracks corresponding to deactivated virtual devices is in fact adeactivated virtual device. If not, then control passes from the step752 to a step 754 where an error is returned to the calling routine.Following the step 754, processing is complete.

[0229] If it is determined at the step 752 that the virtual deviceidentifier that is passed by the calling routine corresponds to adeactivated virtual device, then control passes from the step 752 to astep 756 where it is determined if the requested track corresponds to atrack on the virtual device that points to the log device. As discussedabove, only some of the tracks of the virtual device will correspond toa track of the log device (i.e., tracks that correspond to tracks of thestandard logical device that were written after the virtual device wasestablished and before the virtual device is deactivated). Tracks whichhave not been written to in between the time that the virtual device isestablished and the virtual device is deactivated will not be pointed toon the log device by the virtual device. Thus, if it is determined atthe step 756 that the track identifier passed by the calling routinedoes not correspond to a track pointed to by the virtual device, thencontrol passes from the step 756 to the step 754 where an error isreturned, as discussed above. Otherwise, if it is determined at the step756 that the track is pointed to by the virtual device, then controlpasses from the step 756 to a step 758 where the requested track data isreturned. Following the step 758, processing is complete. Note that, forsome embodiments, it may be possible to request data from a plurality oftracks with one call.

[0230] At some point, it may be useful to deallocate a deactivatedvirtual device. In that case, it would be possible to invoke the routinewhich is discussed above in connection with the flow chart 370 of FIG.14. Note that the steps shown in the flow chart 370 are the same asthose that would be executed to deallocate a deactivated virtual device.

[0231] In some instances, it is useful to be able to obtain data thatexisted on a computer system at a particular time in the past. Insystems where daily backups are made and saved, it may be possible torequest a file or a set of files from a particular day. However, in somecases, the granularity of one day is not sufficient for certainapplications. In addition, such a system may require saving an entiresystem's worth of data every day, which may be considerable. In othercases, it may only be necessary to provide incremental backups. However,incremental backups typically require that the data be first backed upcompletely and then, going forward, only files that have changed sincethe complete backup or the most recent incremental backup are saved. Adifficulty with this is that entire files are saved even though, in somecases, only one track of a file may have changed. In addition,retrieving a file from a particular day may require restoring the entirefile and then rolling the system forward. It would be desirable in somecases instead to be able to start with the current state of the systemand be able to work backwards.

[0232] Referring to FIG. 29, a flow chart 760 illustrates a backupsystem that uses virtual devices to provide track level incrementalbackups. The steps of the flow chart 760 may be performed by a hostsystem running a host application. Processing begins at a first step 762where a new virtual device is established to a standard logical devicethat is the subject of the backup. Following the step 762 is a step 764where an old virtual device that had been previously established to thestandard logical is deactivated. Following the step 764 is a step 766where the tracks corresponding to the old virtual device are saved.Saving the tracks may involve collecting the tracks pointed to by thedeactivated virtual device (i.e., tracks that were modified in betweenthe time that the virtual device was established and the time that thevirtual device was deactivated) using, for example, the mechanismdiscussed above. The tracks may be saved by indicating a correspondingsource track of the standard logical device (which, as discussed above,is saved with each track of the log device). Other information that maybe saved may include a time stamp or an identifier indicating whichbackup session the saved tracks are from.

[0233] The steps of the flow chart 760 may be run every incrementalperiod such as every six hours. Thus, a user wishing to have a versionof a file from one of those six hour increments would be able to do so,as discussed below. Note also that it is possible in some embodiments todeallocate the deactivated virtual device after executing the step 766.

[0234] Referring to FIG. 30, a flow chart 780 illustrates stepsperformed in connection with restoring data using the tracks saved inconnection with the flow chart 760 of FIG. 29. The steps of the flowchart 780 may be performed by a host system running a host application.Processing begins at a first step 782 which starts with the current dataimage. Following step 782 is a step 784 where a pointer is set to pointto the most recent tracks that have been saved. Following step 784 is astep 786 where the tracks that are pointed to are applied to the image.The step 786 represents copying saved tracks to the image to roll theimage back to its state at an earlier time.

[0235] Following the step 786 is a step 788 where the pointer is made topoint to the next most recent set of saved tracks. Following the step788 is a test step 792 where it is determined if processing is complete(i.e., if the rolling backup has worked backwards to the desired time).If it is determined at the step 792 that processing is not complete,then control transfers back to the step 786. Otherwise, it may bedetermined at the step 792 that processing is complete.

[0236] While the invention has been disclosed in connection with variousembodiments, modifications thereon will be readily apparent to thoseskilled in the art. Accordingly, the spirit and scope of the inventionis set forth in the following claims.

What is claimed is:
 1. A method for a host computer to establish acoupling between a logical storage area of a storage device and avirtual storage area of the storage device, the method comprising: thehost computer sending a first command to the storage device to registerthe logical storage area; following the first command, the host computersending a second command to the storage device to relate the logicalstorage area to the virtual storage area; and following the secondcommand, the host computer sending a third command to the storage deviceto activate the coupling between the logical storage area and thevirtual storage area, wherein following activating the coupling,pointers of the virtual storage area point to sections of the logicalstorage area and wherein a write to the logical storage area causes datato be copied from the logical storage area to an other area of thestorage device and causes a corresponding pointer of the virtual storagearea to point to the other area.
 2. A method, according to claim 1,wherein the first command causes creation of the virtual storage area.3. A method, according to claim 1, wherein the second command causescreation of the virtual storage area.
 4. A method, according to claim 1,wherein the second command includes additional parameters.
 5. A method,according to claim 4, wherein the additional parameters are selectedfrom the group consisting of: a new name for the virtual storage areaand an indicator that determines whether the virtual storage area isavailable to a host.
 6. A method, according to claim 1, wherein thestorage areas are devices.
 7. A method for a host computer to establisha coupling between at least one of a plurality of logical storage areasof a storage device and at least one of a corresponding one of aplurality of virtual storage areas of the storage device, the methodcomprising: the host sending commands to the storage device to relatethe at least one of the logical storage areas to a corresponding one ofthe virtual storage areas; and following the host sending commands, thehost causing an activation of couplings between at least one of theplurality of the logical storage areas and corresponding ones of theplurality of virtual storage areas, wherein following activation,pointers of at least one of the virtual storage areas corresponding tothe couplings point to sections of a corresponding one of the logicalstorage areas and wherein a write to the corresponding one of thelogical storage areas causes data to be copied from the correspondingone of logical storage areas to an other area of the storage device andcauses a corresponding pointer of the at least one of the virtualstorage areas to point to the other area.
 8. A method, according toclaim 7, wherein the host sending commands causes creation of the atleast one of the virtual storage areas.
 9. A method, according to claim7, wherein causing activation includes the host sending additionalcommands.
 10. A method, according to claim 9, wherein the additionalcommands include parameters.
 11. A method, according to claim 10,wherein the parameters are selected from the group consisting of: a newname for at least one of the virtual storage areas and an indicator thatdetermines whether at least one of the virtual storage areas isavailable to a host.
 12. A method, according to claim 7, furthercomprising: the host maintaining a list of the logical storage areas andthe virtual storage areas.
 13. A method, according to claim 12, whereincausing an activation of couplings includes passing the list from thehost to the storage device.
 14. A method, according to claim 13, whereinthe list is a linked list.
 15. A method, according to claim 13, whereinpassing the list includes passing a pointer to a data structure thatcontains one of: the list and a pointer to the list.
 16. A method,according to claim 7, wherein the logical storage areas are all part ofa single consistency group.
 17. A method, according to claim 7, whereincausing an activation of couplings includes the host providing oneactivate command to the storage device for each logical storagearea/virtual storage area pair.
 18. A method, according to claim 7,wherein causing an activation of couplings includes the host providing asingle activate command to the storage device that activates all of thelogical storage area/virtual storage area pairs.
 19. A method, accordingto claim 7, wherein the storage areas are devices.
 20. Computer softwarethat establishes a coupling between a logical storage area of a storagedevice and a virtual storage area of the storage device, the softwarecomprising: executable code that sends a first command to the storagedevice to register the logical storage area; executable code that sendsa second command to the storage device to relate the logical storagearea to the virtual storage area following sending the first command;and executable code that sends a third command to the storage device toactivate the coupling between the logical storage area and the virtualstorage area following the second command, wherein following activatingthe coupling, pointers of the virtual storage area point to sections ofthe logical storage area and wherein a write to the logical storage areacauses data to be copied from the logical storage area to an other areaof the storage device and causes a corresponding pointer of the virtualstorage area to point to the other area.
 21. Computer software,according to claim 20, wherein the second command includes additionalparameters.
 22. Computer software, according to claim 21, wherein theadditional parameters are selected from the group consisting of: a newname for the virtual storage area and an indicator that determineswhether the virtual storage area is available to a host.
 23. Computersoftware that establishes a coupling between at least one of a pluralityof logical storage areas of a storage device and at least one of acorresponding one of a plurality of virtual storage areas of the storagedevice, the software comprising: executable code that sends commands tothe storage device to relate the at least one of the logical storageareas to a corresponding one of the virtual storage areas; andexecutable code that causes an activation of couplings between at leastone of the plurality of the logical storage areas and corresponding onesof the plurality of virtual storage areas after the commands are sent,wherein following activation, pointers of at least one of the virtualstorage areas corresponding to the couplings point to sections of acorresponding one of the logical storage areas and wherein a write tothe corresponding one of the logical storage areas causes data to becopied from the corresponding one of logical storage areas to an otherarea of the storage device and causes a corresponding pointer of the atleast one of the virtual storage areas to point to the other area. 24.Computer software, according to claim 23, wherein executable code thatcauses activation sends additional commands.
 25. Computer software,according to claim 24, wherein the additional commands includeparameters.
 26. Computer software, according to claim 25, wherein theparameters are selected from the group consisting of: a new name for atleast one of the virtual storage areas and an indicator that determineswhether at least one of the virtual storage areas is available to ahost.
 27. Computer software, according to claim 23, further comprising:executable code that maintains a list of the logical storage areas andthe virtual storage areas.